7

How do I set up a VS2010 project so that it uses different references based on the chosen platform? In practice, I would like to link a 32-bit library when I choose x86 as platform, but the 64-bit version of it when I choose x64.

Any idea on how to get this swap done for a C# VS2010 project?

Sklivvz
  • 30,601
  • 24
  • 116
  • 172
  • Just don't. The 32-bit and 64-bit versions should contain the same types so it doesn't matter. Metadata is not architecture dependent. Pick AnyCPU for libraries, only the setting for the main EXE project counts. – Hans Passant Feb 22 '11 at 15:37
  • I don't have a choice in the matter, the libs are either 32-bit or 64-bit, there is no AnyCPU (because of native dll integration) – Sklivvz Feb 22 '11 at 15:50
  • @Hans I'm having to solve the same issue - I have a native library for which I have C++/CLI wrapper (having two versions of that is no problem - it uses the C++ build system). But then I have a C# application which references that wrapper - and I have to choose between 32 (compatibility) or 64 (less memory limitations), but I can't have both because of the issue OP faces. – Matěj Zábský Feb 22 '11 at 15:55
  • Possible duplicate of [How to reference different version of dll with MSBuild](https://stackoverflow.com/questions/1997268/how-to-reference-different-version-of-dll-with-msbuild) – Wai Ha Lee Oct 20 '17 at 16:05

1 Answers1

7

Haven't tried it, but possibly you'll need to edit the project file and hack the Conditions into the ItemGroup with the references.

Here you go, found an SO question here with the answer.

Community
  • 1
  • 1
Ralf de Kleine
  • 11,464
  • 5
  • 45
  • 87