I have a project that runs on both .NET and .NET CF. But it uses a 3rd party library
that will not run on both. So I end up changing the reference every time the project gets built.
Project A – References the 3rd party dll.
Project B – References A and runs .NET CF
Project C – References A and runs .NET
Is there a way to automate it?
Here is a link to that 3rd party library: http://dotnetzip.codeplex.com/Wikipage
You can set up two build configurations in your solution – one for .Net and one for .Net CF – and use conditional references to switch which version of the library is referenced.
Set up two new build configurations for
.Netand.Net CF(the same as you would for debug and release configurations ie. Build -> Configuration Manager). Add both the .Net and the .Net CF 3rd party dlls as references to project A. You will then need to hand-edit the project file for project A – see my previous answer for how to do this. Make sure you set project B to not build in the.Netbuild configuration and project C to not build in the.Net CFbuild configuration.This enables you to build either a
.Netoutput or a.Net CFoutput based on the currently selected build configuration, all within one solution, all using the same projects.