Search code examples
c#nugetvisual-studio-2022nuspec

Why does a warning icon appear over an installed nuget package icon?


Image of Dependencies - net8.0-windows - Packages

As you can see, the MCData package has a warning icon. The project MCSecure compiles fine for both net48 and net8.0-windows. So I checked the Messages output and the only issue I can relate to a possible cause for the icon is:

Package 'MCData 25.1.30' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0-windows7.0'. This package may not be fully compatible with your project.

The MCData nuspec file quotes the TargetFrameWork as follows:

target="lib\net8.0-windows10.1\MCData.v25.1.30.dll"

I don't believe you can add a target framework version number in the MCSecure.csproj file so how does the complier come up with a Windows verion of 7.0 as causing the issue.

The above may or may not be the cause for the warning icon but I think it's a fair bet that it is.


Solution

  • Not only can you include target framework values in the .csproj file, if you don't you get the warning described above. Adding the version number removed the warning and the icon...

      <TargetFrameworks>net48;net8.0-windows10.0.17763</TargetFrameworks>