NuGet Framework Targeting in Squirrel - nuget

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.

Related

What is the best approach to read from both Web.config and appsettings.json in a .NET Standard library?

We have an old .NET Framework nuget package built with .NET Framework that reads settings from Web.configs files on .NET Framework projects using the ConfigurationManager.AppSettings class. Now, we need to migrate it to .NET Standard to be able to use it on .NET Core projects also.
Is there an elegant way to try to find and read settings from both Web.config files when running in .NET Framework, and from appsetting.json when running on a .NET Core project? Does it make sense?
Also, it makes sense to have 2 different nuget packages, one for use only on .NET Framework projects and another to use only in .NET Core projects?
The main goal is to read setting independent of the .NET version it is running on.

Nuget : Additional computed target framework(s)

In nuget.org, when you check any package there are 2 types of framework.
What is the difference between Compatible target framework and additional computed target framework?
A compatible target framework is directly derived from the Target Framework Monikers (TFMs) of a NuGet package. In your screenshot, the NuGet package targets net45 and netstandard2.0 - you will find these entries in the corresponding .csproj/.nuspec file.
The additional computed target frameworks are all kind of frameworks which are implicitly supported due API compatibility. For example every project targeting netstandard2.0 is compatible to netstandard2.1, as the APIs of .NET Standard 2.1 completely contain all APIs of .NET Standard 2.0.
The same is true for net45: an application/assembly targeting .NET Framework 4.5 will automatically be supported on .NET Framework 4.6, 4.7, etc.
Microsoft announced this here.

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.

Support .net Core for a nuget package

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

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