使用 MSBuild.exe 部署 MVC 项目失败
Using MSBuild.exe to deploy MVC Project fails
我在 Powershell 中使用 MSBuild.exe 在 VS Pro 2017 中构建和部署 MVC5 应用程序。命令是
&"$env:windir\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" $solutionFilePath `
/p:VisualStudioVersion=14.0 `
/p:DeployOnBuild=true `
/p:PublishProfile=$publishXmlFile `
/p:Password=$password
变量的值是正确的,发布配置文件也很好。但是我在 PS 中遇到构建错误,它说
C:\MyLib\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.wap.targets(50,5): error MSB4062: The "ReadWebJobsConfigFile" task could not be
loaded from the assembly C:\MyLib\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\Microsoft.Web.WebJobs.Publish.Tasks.dll. Could not load file
or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system
cannot find the file specified. Confirm that the 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. [C:\MyLib\TestMVCProject\TestMVCProject.c
sproj]
对此有任何帮助吗?
1.ForVS2017。通常,我们使用IDE文件夹下的msbuild.exe,如:C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\Bin\MSBuild.exe,而不是framework文件夹下的,因为IDE 中的工具效果更好。
2.For vs2017,版本是15,而vs2017,是14等...
谢谢。
我在 Powershell 中使用 MSBuild.exe 在 VS Pro 2017 中构建和部署 MVC5 应用程序。命令是
&"$env:windir\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" $solutionFilePath `
/p:VisualStudioVersion=14.0 `
/p:DeployOnBuild=true `
/p:PublishProfile=$publishXmlFile `
/p:Password=$password
变量的值是正确的,发布配置文件也很好。但是我在 PS 中遇到构建错误,它说
C:\MyLib\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.wap.targets(50,5): error MSB4062: The "ReadWebJobsConfigFile" task could not be loaded from the assembly C:\MyLib\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\Microsoft.Web.WebJobs.Publish.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the 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. [C:\MyLib\TestMVCProject\TestMVCProject.c sproj]
对此有任何帮助吗?
1.ForVS2017。通常,我们使用IDE文件夹下的msbuild.exe,如:C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\Bin\MSBuild.exe,而不是framework文件夹下的,因为IDE 中的工具效果更好。
2.For vs2017,版本是15,而vs2017,是14等... 谢谢。