部署到 azure 错误

Deploy to azure error

我已经尝试按照 http://docs.virtocommerce.com/display/vc1devguide/Source+Code+Azure+Deployment 中提供的步骤将 virtocommerce 部署到 azure,但是我在构建过程中遇到了一些错误...

MSBUILD 4.0 Path = C:\Windows\Microsoft.NET\Framework\v4.0.30319\
03/03/2015 17:21:12 - Solution Build: In progress
Version: 1.0.62.1721
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34014]

构建于 2015 年 3 月 3 日开始17:21:12。

 1>Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" on node 1 (clean target(s)).

 1>ValidateSolutionConfiguration:

     Building solution configuration "Release|Any CPU".

   ValidateProjects:

     The project "Performance.FunctionalTests" is not selected for building in solution configuration "Release|Any CPU".

   The target "MSDeployPublish" listed in a BeforeTargets attribute at "C:\code\github\VirtoCommerceCommunity\vc-community-master\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.wap.targets (89,11)" does not exist in the project, and will be ignored.

   The target "MSDeployPublish" listed in an AfterTargets attribute at "C:\code\github\VirtoCommerceCommunity\vc-community-master\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.wap.targets (156,11)" does not exist in the project, and will be ignored.

 1>Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" (1) is building "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Scheduler\AzureScheduler\AzureScheduler.ccproj" (61) on node 7 (Clean target(s)).

C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Scheduler\AzureScheduler\AzureScheduler.ccproj(68,3):错误 MSB4019:找不到导入的项目 "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools.4\Microsoft.WindowsAzure.targets"。确认声明中的路径正确,并且该文件存在于磁盘上。

61>Done Building Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Scheduler\AzureScheduler\AzureScheduler.ccproj" (Clean target(s)) -- FAILED.

 1>Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" (1) is building "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WebRoles\Frontend\CommerceSite\CommerceSite.ccproj" (62) on node 2 (Clean target(s)).

62>C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WebRoles\Frontend\CommerceSite\CommerceSite.ccproj(71,3): error MSB4019: The imported project "**C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools.4\Microsoft.WindowsAzure.targets**" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

62>Done Building Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WebRoles\Frontend\CommerceSite\CommerceSite.ccproj" (Clean target(s)) -- FAILED.

 1>Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" (1) is building "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Search\ElasticSearch\ElasticSearch.ccproj" (66) on node 6 (Clean target(s)).
66>C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Search\ElasticSearch\ElasticSearch.ccproj(70,3): error MSB4019: The imported project "**C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools.4\Microsoft.WindowsAzure.targets**" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
66>Done Building Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Search\ElasticSearch\ElasticSearch.ccproj" (Clean target(s)) -- FAILED.

 1>Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" (1) is building "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Extensions\Jobs\SchedulerConsole\SchedulerConsole.csproj" (69) on node 1 (Clean target(s)).

69>C:\code\github\VirtoCommerceCommunity\vc-community-master\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.console.targets(25,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Extensions\Jobs\SchedulerConsole\SchedulerConsole.csproj]
69>Done Building Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Extensions\Jobs\SchedulerConsole\SchedulerConsole.csproj" (Clean target(s)) -- FAILED.
 1>Done Building Project "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" (clean target(s)) -- FAILED.
Build FAILED.




   "C:\code\github\VirtoCommerceCommunity\vc-community-master\VirtoCommerce.sln" (clean target) (1) ->

   "C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Scheduler\AzureScheduler\AzureScheduler.ccproj" (Clean target) (61) ->

     C:\code\github\VirtoCommerceCommunity\vc-community-master\src\Azure\WorkerRoles\Scheduler\AzureScheduler\AzureScheduler.ccproj(68,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools.4\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

... 构建失败

At C:\code\github\VirtoCommerceCommunity\vc-community-master\src\extensions\Setup\VirtoCommerce.PowerShell\azure-deploy.ps1:445 char:11

+           throw "Build Failed"
+           ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (Build Failed:String) [], RuntimeException
+ FullyQualifiedErrorId : Build Failed

我试过不同的机器(Windows 8.1 和 Windows Server 2012),都使用 Visual Studio 2013,发现同样的错误... 有趣的是,在两台机器上,目录 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools 不存在... Azure 工具仅存在于 \VisualStuion\v12.0 目录...

我们如何解决这个问题?

提前致谢!

问题似乎与 msbuild 如何与 VS.NET 2013 (http://blog.maskalik.com/msbuild/2014/03/04/changes-in-msbuild-with-visual-studio-2013/) 打包有关。为了让 powershell deploy 开箱即用,需要安装 VS.NET 2012。解决方法是修改 azure-deploy.ps1 以指向 VS.NET 2013 中的 MSBuild,而不是 .NET SDK。

因此将第 426 行从

更改为
$global:buildexe_path = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions.0" -Name MSBuildToolsPath).MSBuildToolsPath

到(简单地将 4.0 更改为 12.0)

$global:buildexe_path = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions.0" -Name MSBuildToolsPath).MSBuildToolsPath

一旦通过我们的CI,它将包含在下一个补丁中。