我有一个需要硬codeA路径可执行文件的构建脚本。路径是:
I have a build script that needs to hard code a path to an executable. The path is:
C:\ Program Files文件\微软的Visual Studio 9.0 \ SmartDevices \ SDK \ SDKTools \ cabwiz.exe这一直很好,但现在我在64位操作系统上运行(但我的同事和构建服务器都在32位仍)。
This has worked fine, but now I am running on a 64 bit OS (but my coworker and build server are on 32 bit still).
我需要的路径是这样对我说:
I need the path to be this for me:
C:\ Program Files文件(86) \微软的Visual Studio 9.0 \ SmartDevices \ SDK \ SDKTools \ cabwiz.exe C:\Program Files (x86)\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe但使用普通的路径,等等。
But use the normal path for the others.
下面是我如何设置它:
<PropertyGroup>
<CabWiz>"C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe"</CabWiz>
</PropertyGroup>
有一个条件,我可以把上,这样我可以将它设置,如果操作系统(而不是当前构建配置)是64位?
Is there a condition I can put on that so that I can set it if the OS (not the current build configuration) is 64 bit?
有一个注册表项,将告诉你的位edness当前的操作系统。下面是我在我的MSBuild文件中使用的属性:
There is a registry key that will tell you the bit-edness of the current OS. Here are the properties I use in my MSBuild files:
<PropertyGroup>
<MachineProcessorArchitecture>$(registry:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment@PROCESSOR_ARCHITECTURE)</MachineProcessorArchitecture>
<Is32Bit>False</Is32Bit>
<Is32Bit Condition="'$(MachineProcessorArchitecture)' == 'x86'">True</Is32Bit>
<Is64Bit>False</Is64Bit>
<Is64Bit Condition="'$(MachineProcessorArchitecture)' == 'AMD64'">True</Is64Bit>
</PropertyGroup>