views:

138

answers:

1

For reference, I'm using Visual Studio 2010.

I have a custom build step defined as follows:

if exist "$(TargetDir)"server.dll copy "$(TargetDir)"server.dll "c:\program files (x86)\myapp\server.dll"

This works great on my desktop, which is running 64-bit Windows. However, when I build on my laptop, c:\Program Files (x86)\ doesn't exist because it's running 32-bit Windows. I'd like to put in something that will work between both editions of Windows, since the project files are under version control and it's a real pain to change the paths every time I work on my laptop.

If this were a *nix environment I'd just create a symlink and be done with it. Any ideas?

+1  A: 

You can put this in your project file:

 <PropertyGroup>
    <ProgramFiles32 Condition="Exists('$(PROGRAMFILES) (x86)')">$(PROGRAMFILES) (x86)</ProgramFiles32>
    <ProgramFiles32 Condition="$(ProgramFiles32) == ''">$(PROGRAMFILES)</ProgramFiles32>
  </PropertyGroup>

And then you can use $(ProgramFiles32) in your post build event.

For more information check this stackoverflow question.

Thomas
I used "$(MSBuildExtensionsPath32)\.." from the link you provided. Works great, thanks!
Bob Somers