VCUpgrade更改工具集版本

时间:2016-10-15 23:59:03

标签: visual-studio msbuild arm

我有一个来自Visual Studio 2010的VCXPROJ文件。该文件多年来一直支持Win32和x64,可追溯到VC ++ 5.0天。我们正在尝试为其添加ARM支持。

我们在文本编辑器下打开文件并添加了以下元素。首先,我们添加了ProjectConfiguration Debug|ARMRelease|ARM

<ItemGroup Label="ProjectConfigurations">
  <ProjectConfiguration Include="Debug|Win32">
    <Configuration>Debug</Configuration>
    <Platform>Win32</Platform>
  </ProjectConfiguration>
  ...
  <ProjectConfiguration Include="Debug|ARM">
    <Configuration>Debug</Configuration>
    <Platform>ARM</Platform>
  </ProjectConfiguration>
  <ProjectConfiguration Include="Release|ARM">
    <Configuration>Release</Configuration>
    <Platform>ARM</Platform>
  </ProjectConfiguration>
</ItemGroup>

其次,我们为ARM添加了PropertyGroup并保护了Globals配置:

<PropertyGroup Label="Globals" Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">
  <ProjectGuid>{c39f4b46-6e89-4074-902e-ca57073044d2}</ProjectGuid>
  <RootNamespace>cryptlib</RootNamespace>
  <PlatformToolset>v100</PlatformToolset>
  <ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>

<PropertyGroup Label="Globals" Condition="'$(Platform)'=='ARM'">
  <ProjectGuid>{c39f4b46-6e89-4074-902e-ca57073044d2}</ProjectGuid>
  <RootNamespace>cryptlib</RootNamespace>
  <PlatformToolset>v110_wp80</PlatformToolset>
  <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
  <ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>

当我们在Visual Studio 2012或2013下打开项目时,我们看到升级/重新定位后项目工具集已更改:

Upgrading project 'cryptlib'...
    Configuration 'DLL-Import Debug|x64': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'DLL-Import Debug|Win32': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'DLL-Import Release|x64': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'DLL-Import Release|Win32': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'Debug|Win32': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'Debug|ARM': changing Platform Toolset to 'v120' (was 'v110_wp80').
    Configuration 'Debug|x64': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'Release|Win32': changing Platform Toolset to 'v120' (was 'v100').
    Configuration 'Release|ARM': changing Platform Toolset to 'v120' (was 'v110_wp80').
    Configuration 'Release|x64': changing Platform Toolset to 'v120' (was 'v100').
Retargeting End: 1 completed, 0 failed, 0 skipped

但是, Configuration Manager 缺少ARM配置:

enter image description here

我的第一个问题是,为什么 Configuration Manager 缺少ARM配置?我们需要做什么 Configuration Manager 使选择可用?

在ARM支持中继续进行实验...当我进入Visual Studio ARM开发人员提示符,然后在升级/重新定位后尝试构建它:

C:\Users\Test>msbuild /t:build /p:Configuration=Debug;Platform=ARM cryptlib.vcxp
roj
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 10/15/2016 7:52:13 PM.
Project "C:\Users\Test\cryptlib.vcxproj" on node 1 (build target(s)).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\ARM\PlatformToo
lsets\v120\Toolset.targets(36,5): error MSB8022: Compiling Desktop applications 
for the ARM platform is not supported. [C:\Users\Test\cryptlib.vcxproj]
Done Building Project "C:\Users\Test\cryptlib.vcxproj" (build target(s)) -- FAIL
ED.

Build FAILED.

"C:\Users\Test\cryptlib.vcxproj" (build target) (1)
->
  (_WindowsSDKDesktopARMSupportInstalled target) ->
  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\ARM\PlatformT
oolsets\v120\Toolset.targets(36,5): error MSB8022: Compiling Desktop application
s for the ARM platform is not supported. [C:\Users\Test\cryptlib.vcxproj]

    0 Warning(s)
    1 Error(s)

显而易见的是,Visual Studio从v110_wp8更改了平台工具集,并且它曾经工作过。一旦Visual Studio将其更改为v120,它就不再有效。

我的第二个问题是,Visual Studio会发生什么?为什么它采取“好”配置并将其变成“坏​​”配置?

1 个答案:

答案 0 :(得分:1)

  
    

我的第一个问题是,为什么Configuration Manager错过了ARM

  

配置?我们需要做什么才能使Configuration Manager可以选择?

我们可以使用Configuration Manager添加arm平台(Configuration Manager-&gt;来自Active解决方案平台列表 - &gt; Add - &gt;选择Arm-&gt; OK)。

  
    

我的第二个问题是,Visual Studio会发生什么?为什么要这样做     一个“好”的配置,把它变成一个“坏”的配置?

  

我创建了一个演示并在我身边重现你的问题,似乎vs2012(与vs2013和vs2015相同),默认情况下不支持arm平台,你可以编辑文件来打开这个功能(需要管理员权限):

<PropertyGroup>

<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport> 部分添加以下行:

</PropertyGroup>

之前=IF(ISNUMBER(E2), IF(E2>0, "yes", "no"), "no")

致以最诚挚的问候,

科尔吴