当前位置: 动力学知识库 > 问答 > 编程问答 >

msbuild - VSTS build fails because it tries to build a UWP project for AnyCPU

问题描述:

I'm trying to build a UWP project on VSTS (Visual Studio Team Services). When built the following error message occurs and the build fails.

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

The solution consists of 3 projects.

  • Dummy.Win which is the UWP project based on 10586
  • Dummy.Core which is a PCL
  • Dummy.Test which is a test project

Dummy.Win references Dummy.Core.

The following command line shows how msbuild is called (added some line breaks):

"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"

The question is: Why is msbuild trying to build the UWP project for AnyCPU? Running this command locally does not show this error (still doesn't create a .appxupload file but that's another issue)

网友答案:

This may caused by the build platform of other projects in your solution. For example, the "Dummy.Test" project. If it is a general test project instead of a universal windows test project. Then the build platform for it will be "Any CPU" by default. And a build settings with "Release" configuration and "Any CPU" platform will be added to your solution.

Right click on your solution from VS and select "Configuration Manager...", select "Release" for "Active solution configuration:" and "Any CPU" for "Active solution platform:", and then check if the "Build" option of "Dummy.Win" project is checked. If not, check the option and check in the changes and then try the build again.

网友答案:

Open the .SLN solution file with a text editor and find the section SolutionConfigurationPlatforms as shown below. Delete the lines having "Any 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
分享给朋友:
您可能感兴趣的文章:
随机阅读: