Custom ways to create steps between x86 and x64 in Visual Studio

For reference, I am using Visual Studio 2010.

I have a custom build step that is defined as follows:

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

This works fine on my desktop on which 64-bit Windows is installed. However, when I build on my laptop, c: \ Program Files (x86) \ does not exist because it works with 32-bit Windows. I would like to add something that will work between both versions of Windows, since project files are versioned, and it is a real pain to change paths every time I work on my laptop.

If it were * nix, I would just create a symbolic link and end it. Any ideas?

+3
source share
1 answer

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 event after build.

For more information check out this stackoverflow question.

+3
source

Source: https://habr.com/ru/post/1741643/


All Articles