VSTS构建失败,因为它尝试为AnyCPU构建UWP项目

时间:2016-05-30 05:27:29

标签: msbuild win-universal-app uwp azure-pipelines

我正在尝试在VSTS上构建一个UWP项目(Visual Studio Team Services)。构建时,会出现以下错误消息,并且构建失败。

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

该解决方案包含3个项目。

  • Dummy.Win这是基于10586的UWP项目
  • Dummy.Core这是一个PCL
  • Dummy.Test这是一个测试项目

Dummy.Win引用Dummy.Core

以下命令行显示了msbuild的调用方式(添加了一些换行符):

"C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe" 
  "C:\a\1\s\Dummy.sln" /nologo /m /nr:false 
  /fl /flp:"logfile=C:\a\1\s\Dummy.sln.log" 
  /dl:CentralLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.99.0\Agent\Worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.99.0\Agent\Worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"
  /p:AppxBundlePlatforms="x86|x64|ARM" 
  /p:AppxPackageDir="C:\a\1\b\AppxPackages\\" 
  /p:AppxBundle=Always 
  /p:configuration="Release" 
  /p:VisualStudioVersion="14.0"

问题是:为什么msbuild尝试为AnyCPU构建UWP项目?在本地运行此命令不会显示此错误(仍然不会创建.appxupload文件,但这是另一个问题)

2 个答案:

答案 0 :(得分:0)

这可能是由解决方案中其他项目的构建平台引起的。例如,“Dummy.Test”项目。如果它是一般测试项目而不是通用Windows测试项目。然后,它的构建平台默认为“Any CPU”。具有“Release”配置和“Any CPU”平台的构建设置将添加到您的解决方案中。

右键单击VS中的解决方案并选择“Configuration Manager ...”,为“Active solution platform:”选择“Release”,为“Active solution platform:”选择“Any CPU”,然后检查“建立“Dummy.Win”项目的“选项”。如果没有,请检查选项并检查更改,然后再次尝试构建。

答案 1 :(得分:0)

使用文本编辑器打开.SLN解决方案文件,找到SolutionConfigurationPlatforms部分,如下所示。删除具有“任何CPU”的行

GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Debug|ARM = Debug|ARM
        Debug|x64 = Debug|x64
        Debug|x86 = Debug|x86
        Release|Any CPU = Release|Any CPU
        Release|ARM = Release|ARM
        Release|x64 = Release|x64
        Release|x86 = Release|x86