MSB4018:" GetFrameworkPath"任务意外失败

时间:2016-07-28 06:54:53

标签: c# visual-studio .net-core visual-studio-2017

我无法在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包或代码。我已经采取了以下步骤:

  1. 重新启动Visual Studio
  2. 清洁解决方案
  3. 以管理员权限运行Visual Studio
  4. 如果有人遇到类似问题,请提供帮助。

    我在Visual Studio社区网站上看到了类似的问题,但没有人回复 - https://community.visualstudio.com/problems/55/error-msb4018-the-getframeworkpath-task-failed-une.html

0 个答案:

没有答案