MSBuild Program Files Environment Variable Cross Platform?

353 Views Asked by At

I have an MSBUILD target snippet that has something like the below to execute an external application:

<Exec Command="&quot;C:\Program Files\dir\do.exe....&quot;" />

It works fine on an x86 machine, but of course it broke when running on an x64 system because the path should be "Program Files (x86)". What is the proper way to handle the pathing in a cross-platform manner for build files?

Thanks.

1

There are 1 best solutions below

0
On

Reading this:

http://social.msdn.microsoft.com/Forums/en/msbuild/thread/261edf66-c16d-4be0-995f-5f1edc2ac7b6

Shows that setting a variable and then doing an override will work. I am experimenting with this and it appears to work:

 <PropertyGroup>
     <properPath>c:\program files\etc...</properPath>
     <properPath Condition="'$(PROCESSOR_ARCHITECTURE)'=='AMD64' or '$(PROCESSOR_ARCHITEW6432)'=='AMD64'">c:\program files (x86)\etc...</properPath>
 </PropertyGroup>