Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net core 从.NET Core引用System.ComponentModel.Composition.Registration时出现不兼容警告_.net Core - Fatal编程技术网

.net core 从.NET Core引用System.ComponentModel.Composition.Registration时出现不兼容警告

.net core 从.NET Core引用System.ComponentModel.Composition.Registration时出现不兼容警告,.net-core,.net Core,我在.NET Core 3.1项目中间接引用Nuget包System.ComponentModel.Composition.Registration时收到此警告。我不知道是什么原因造成的,也不知道该怎么办 Package 'System.ComponentModel.Composition.Registration 4.7.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NE

我在.NET Core 3.1项目中间接引用Nuget包System.ComponentModel.Composition.Registration时收到此警告。我不知道是什么原因造成的,也不知道该怎么办

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.

卸载此合成。如果不需要,请注册。它与您的新3.1项目不兼容。

我在System.Windows.Forms中也遇到了同样的问题。确保程序集引用正确,或尝试使用dotnet add package[yourpackagehere]安装

如果这不起作用,这个问题的答案解决了我的问题:

只需输入.csproj项目组部分

我不完全确定这是否有效,但值得一试


希望能成功

它包含在Microsoft.Windows.Compatibility 3.1.0包中,该包专为.NET Core设计。我需要它以Windows服务的形式运行应用程序。事实证明,只有在使用nuget.exe restore还原包时才会发生这种情况。切换到dotnet还原解决了这个问题。