3

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?

Bob Somers
  • 7,266
  • 5
  • 42
  • 46

1 Answers1

3

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.

Community
  • 1
  • 1
Thomas
  • 7,933
  • 4
  • 37
  • 45