0

I'm getting this warning when indirectly referencing the Nuget package System.ComponentModel.Composition.Registration in my .NET Core 3.1 project. I'm not sure what's causing this or what do do about it.

Package 'System.ComponentModel.Composition.Registration 4.7.0' 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'
 instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not
 be fully compatible with your project.
kwl
  • 495
  • 6
  • 13
  • It turned out this only happened when packages were restored using `nuget.exe restore`. Switching to `dotnet restore` solved the problem. – kwl Feb 10 '20 at 12:04

2 Answers2

1

I had this same issue with System.Windows.Forms. Make sure the assembly reference is correct or try to install with dotnet add package [yourpackagehere].

If this doesn't work, the answer to this question solved my issue: Unable to resolve System.Windows.Forms.dll in .Net Core 3.1

Just put <FrameworkReference Include="Microsoft.WindowsDesktop.App" /> into your .csproj ItemGroup section.

I'm not entirely sure whether this would work or not but it's worth a try.

Hope that works!

0

Uninstall this Composition.Registration if you don't need it. It's just not compatible with your new 3.1 project.

Asherguru
  • 1,687
  • 1
  • 5
  • 10
  • It is included through the package `Microsoft.Windows.Compatibility` 3.1.0 which is specifically designed for .NET Core. I need it to run the application as a Windows service. – kwl Jan 21 '20 at 09:11