This might be a silly question but I have to add reference to %programfiles(x86)%
folder (on a 64 bit machine) OR to %programfiles%
folder (on a 32 bit machine). I also have to set CopyLocal
to false so that the DLLs are not copied to bin/debug
folder of my project but always point to the same %programfiles%
location.
How do I add reference to %programfiles(x86)%
in Visual Studio 2010?
The solution is to edit the .csproj manually by opening it in a text editor and changing the HintPath of the DLL that you are referencing. Since I always need to refer location of 32-bit Program Files, I use $(ProgramFiles)
in HintPath which resolves to %programfiles%
or %programfiles(x86)%
automatically.
An alternative to "$(ProgramFiles)" is "$(MSBuildProgramFiles32)", which may be slightly more future-proof. See here: Use 32bit "Program Files" directory in msbuild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With