When consuming a NuGet package in a framework 4.8 project, nuget modifies the csproj to refer to assemblies such as System.Io as packages, rather than as assembly references. This causes problems.For example, nuget alters my csproj to have this:
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"><HintPath>..\..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath><Private>True</Private></Reference> -->
instead, I would expect
<Reference Include="System.IO" />
A framework 4.8 project should refer to the System.IO assembly, not the package.
The package is one that I have created. It targets multiple frameworks. A nuspec file is automatically generated. The nuspec includes lines like this:
<frameworkAssemblies><frameworkAssembly assemblyName="System.IO" targetFramework=".NETFramework4.8" />
That seems correct, according to The doc on which says
Framework assemblies are those that are part of the .NET framework and should already be in the global assembly cache (GAC) for any given machine. By identifying those assemblies within the element, a package can ensure that required references are added to a project in the event that the project doesn't have such references already.
Why would nuget add these to the csproj as package references instead of assembly references?These cause build problems.