Support .net Core for a nuget package - nuget

I have created a nuget package implementing TinyEncryptionAlgorithm but it supports only .Net 4.6.1
Now I want to use this nuget into a .net core application NETStandard.Library and I don't know what I have to do.
Do I have to implement a completely new nuget package or I can include both assemplies in the same nuget package?
I have tried to create a NetStandard library and reference it from a .Net 4.6.1 but this is not working.

To support multiple version of .Net you must create portable libs.
Here is a tutorial of how to publish nuget for portable libs.
https://docs.nuget.org/ndocs/guides/create-net-standard-packages-vs2015

Related

NuGet Framework Targeting in Squirrel

I'm trying to better understand the proper use of .NET Framework version targeting in the project's NuSpec file, as relates to Squirrel.
For example:
<file src="bin\Release\*.dll" target="lib\net472\"></file>
Does the version specified here affect Squirrel's operations at all? Or is it a NuGet-specific construct only?
What does it mean when we say .NET 4.8 is now supported?
The behavior by NuGet is driven by the compatibility map of the frameworks.
.NET Framework is mostly backwards compatible, so NuGet has built on top of that, when your package declares that it targets net472, net48 as the next evolution is acceptable.
NuGet will allow this package to be consumed in .NET Framework 4.8 projects.
See more for .NET Framework version compatibility.
See more on cross platform targeting libraries, which talks about the multi targeting concept.

NuGet package not installing in .NET Framework

I have created .net standard library project and I have created nuget package for this library, Now I need to install this package in both application .Net Core and .Net Framework4.5. Working fine in .Net Core but while installing .Net framework project it was showing below exception.
You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Please let me know the right approach to resolve this.
The library that you have created targets .NET Standard 2.0, as stated in your tags. .NET Framework 4.5.2 does only implement .NET Standard up to version 1.2, that is why the assemblies are not compatible.
You should change your library to a .NET Standard version that is implemented by both .NET Core and .NET Framework or upgrade your .NET Framework version accordingly.
You can find the version mappings here, credits to #Matt Ward for providing the source.

Are xdt transforms not supported in nuget packages installed in a netstandard 2.0 project?

I have a nuget package that has .xdt transforms for a app.config file. The xdt files are included in the netstandard 2.0 project that builds the nuget package. Their build action is set to content/do not copy. When I install the package in a .net framework project, the xdt transforms work corectly, but when I install the package in a netstandard 2.0 project, the xdt files do not transform the config file, but instead are added to the project with a build action of C# Compiler. Does nuget not support xdt transforms on netstandard projects?
You are right, xdt transforms aren't supported in PackageReference environment. This includes both sdk-based projects as well as classic .net framework projects using PackageReference instead of packages.config. You can follow this GitHub issue for more details. There is also a sample package that shows how to use build-time logic to apply transforms instead to work in all environments.
Also note that .NET Standard and .NET Core projects don't have an app.config file that a transform could apply to. This is only relevant for .NET Framework / classic Web Applications. (with maybe an exception for IIS settings for ASP.NET Core apps but they don't affect the app itself, only IIS hosting environment).

Which lib folder should I use for my portable library targeting net45, asp.net core 5.0 and windows 8?

I am currently developing a portable library in C# that I want to publish on the NuGet official feed. I have published assemblies as NuGet packages before, but they were written against a single framework (.NET 4.0).
Now I'm confused how I should organize my lib folder in my NuGet package - my portable library can be used with .NET 4.5, ASP.NET Core 5.0, Windows 8, Windows Phone 8.1 and Windows Phone Silverlight 8 projects.
I tried to look up the framework profiles and their corresponding NuGet abbreviations, but I couldn't find them in the official documentation. Stephen Cleary gathered up profiles a while ago, but his list does not contain the profile for ASP.NET Core 5.0.
My actual question is: how should I structure the lib folder of my NuGet package? What is the profile name for portable libraries that target the framework versions mentioned above? And if I get that very profile name, is the assembly properly referenced in a non-portable library project (e.g. .NET 4.5 or WinRT)? Or should I make subfolders for the different framework version and copy the exact same assembly in all of them (which would largely increase the size of the package)? I habe seen some packages (like xunit.assert) doing it this way in NuGet Package Explorer.
The actual folder name that one has to use in this case is the following one:
portable-net45+wp80+win8+wpa81+dnxcore50

Install Entity Framewok v5 in Webmatrix 2 RC

I'm working on a project with Entity Framework in Webmatrix 2 RC, so I need to use Entity Framework v.5 RC because of conflicts between previous versions and .NET Framework 4.5.
The two ways I know to install NuGet packages in Webmatrix are from the NuGet Gallery on the Webmatrix ribbon and from the package manager in ASP.NET Web Pages Administration: either solution proposes only Entity Framework v4.3.1.
I have downloaded Entity Framework v.5 RC with the Package Manager Console of Visual Web Developer and copied the EntityFramework.dll into the bin folder of my project.
This solution works but I wonder if exists a way to install a not recommended NuGet package that doesn't require the use of Visual Web Developer.
You can use nuget.exe or NuGet Package Explorer, both are standalone and lightweight. You'll still have to manually add references to the files though.