Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add reference from %programfiles(x86)%?

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?

like image 970
Mayank Avatar asked Aug 11 '11 06:08

Mayank


2 Answers

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.

like image 81
Mayank Avatar answered Sep 29 '22 20:09

Mayank


An alternative to "$(ProgramFiles)" is "$(MSBuildProgramFiles32)", which may be slightly more future-proof. See here: Use 32bit "Program Files" directory in msbuild

like image 21
RenniePet Avatar answered Sep 29 '22 21:09

RenniePet