我无法在Visual Studio 15 Preview 3中运行简单的控制台应用程序。我在Console Application
下使用了Visual C# -> Windows
项目模板。它失败并出现以下错误:
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: The "GetFrameworkPath" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: System.ArgumentException: Visual Studio version "4.0" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion.
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at Microsoft.Build.Shared.ErrorUtilities.ThrowArgument(Exception innerException, String resourceName, Object[] args)
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at Microsoft.Build.Shared.FrameworkLocationHelper.GetVisualStudioSpec(Version version)
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at Microsoft.Build.Tasks.GetFrameworkPath.<>c.<.cctor>b__0_5()
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at System.Lazy`1.CreateValue()
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at System.Lazy`1.get_Value()
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4018: at Microsoft.Build.Tasks.GetFrameworkPath.get_FrameworkVersion40Path()
1>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3389,7): error MSB4028: The "GetFrameworkPath" task's outputs could not be retrieved from the "FrameworkVersion40Path" parameter. Visual Studio version "4.0" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.VisualStudioVersion.
这是我的App.config文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
我没有在默认模板样板代码中添加任何新引用,nuget包或代码。我已经采取了以下步骤:
如果有人遇到类似问题,请提供帮助。
我在Visual Studio社区网站上看到了类似的问题,但没有人回复 - https://community.visualstudio.com/problems/55/error-msb4018-the-getframeworkpath-task-failed-une.html