【发布时间】:2019-10-25 00:35:26
【问题描述】:
我收到了这个错误
Your project does not reference ".NETFramework,Version=v4.6.1" framework. Add a reference to ".NETFramework,Version=v4.6.1" in the "TargetFrameworks" property of your project file and then re-run NuGet restore. 从公司存储库中签出项目并在我的机器上重建。
当我尝试安装 .Net461(从here 下载)时,他们说
.NET Framework 4.6.1 或更高版本已安装在此计算机上。
这是我机器上的所有 .NET 框架版本(Windows 10 1703)
PS C:\Users\longnx\Downloads> & '.\check-dotnet-framework-version (1).ps1'
PSChildName Version Release
----------- ------- -------
v2.0.50727 2.0.50727.4927
v3.0 3.0.30729.4926
Windows Communication Foundation 3.0.4506.4926
Windows Presentation Foundation 3.0.6920.4902
v3.5 3.5.30729.4926
Client 4.7.03062 461814
Full 4.7.03062 461814
Client 4.0.0.0
PS C:\Users\longnx\Downloads>
如何解决此错误?
2020-05-26 更新:
对于任何面临这个问题的人,我不建议这样做,但根据我的经验,我已经卸载并重新安装了 Visual Studio,问题就消失了。
【问题讨论】:
-
如果您在解决方案资源管理器中右键单击项目并打开属性,在左侧的应用程序选项下,
Target Framework字段的设置是什么? -
@Dortimer 这是 4.6.1 imgur.com/a/Ab2OJNN
-
我会按照安装程序提供的链接尝试卸载并重新安装它。 docs.microsoft.com/en-us/dotnet/framework/install/…。我不相信 PowerShell 命令会显示您要查找的内容。
标签: c# .net msbuild nuget nuget-package-restore