MSBuild 社区任务即使安装也无法加载
MSBuild community tasks can not be loaded even when it is installed
我有一个 WPF 应用程序,大约一年没有接触过,现在我有了一台新 PC。
当我从 git 克隆应用程序并尝试 运行 它时,出现此错误:
Severity Code Description Project File Line Suppression State
Error The "MSBuild.Community.Tasks.AssemblyInfo" task could not be loaded from the assembly D:\MyData\SourceCodes\Library\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
当我尝试从此处安装 Microsoft.Build.Utilities.Core 时:
https://www.nuget.org/packages/Microsoft.Build.Utilities.Core/
我收到这个错误:
Install-Package : Could not install package 'Microsoft.Build.Utilities.Core 15.9.20'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does
not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Microsoft.Build.Utilities.Core -Version 15.9.20
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
我该如何解决这个问题?
我用的是VS 2017,原来的项目是用VS 2013编译的,有什么区别吗?
您需要安装 .Net Framework 3.5 (link),因为您需要 'Microsoft.Build.Utilities, Version=2.0.0.0'。如果我没记错的话,它是崩溃到 4.0 版的依赖项之一
我有一个 WPF 应用程序,大约一年没有接触过,现在我有了一台新 PC。 当我从 git 克隆应用程序并尝试 运行 它时,出现此错误:
Severity Code Description Project File Line Suppression State
Error The "MSBuild.Community.Tasks.AssemblyInfo" task could not be loaded from the assembly D:\MyData\SourceCodes\Library\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
当我尝试从此处安装 Microsoft.Build.Utilities.Core 时:
https://www.nuget.org/packages/Microsoft.Build.Utilities.Core/
我收到这个错误:
Install-Package : Could not install package 'Microsoft.Build.Utilities.Core 15.9.20'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does
not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Microsoft.Build.Utilities.Core -Version 15.9.20
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
我该如何解决这个问题?
我用的是VS 2017,原来的项目是用VS 2013编译的,有什么区别吗?
您需要安装 .Net Framework 3.5 (link),因为您需要 'Microsoft.Build.Utilities, Version=2.0.0.0'。如果我没记错的话,它是崩溃到 4.0 版的依赖项之一