如何修复Microsoft代码分析包兼容性问题?

时间:2017-12-13 20:22:16

标签: visual-studio

我收到了这4个令人痛苦的错误:

Severity    Code    Description Project File    Line    Suppression State
Error   NU1202  Package Microsoft.CodeAnalysis.Common 1.3.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.CodeAnalysis.Common 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7) 

Severity    Code    Description Project File    Line    Suppression State
Error   NU1202  Package Microsoft.CodeAnalysis.CSharp 1.3.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.CodeAnalysis.CSharp 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)             

Severity    Code    Description Project File    Line    Suppression State
Error   NU1202  Package Microsoft.CodeAnalysis.Common 1.3.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.CodeAnalysis.Common 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)             

Severity    Code    Description Project File    Line    Suppression State
Error   NU1202  Package Microsoft.CodeAnalysis.CSharp 1.3.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.CodeAnalysis.CSharp 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7) 

它过去没有出现过,但经过一些Visual Studio的修复/修改/重新安装后,它现在显示出来了。我需要在核心1.1中创建一个MVC,我只是想摆脱这些错误。为什么我会收到这些错误?

1 个答案:

答案 0 :(得分:0)

您可以找到此错误here的Microsoft文档。

此错误通常是由不支持项目目标框架的NuGet包引起的。检查您引用的包并确保它们支持您的目标框架,并尝试删除并重新添加它们以找出导致错误的包。

您也可以尝试this answer中的方法,他们建议您运行以下命令: dotnet nuget locals all --clear