0

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

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
NitroxDM
  • 5,039
  • 10
  • 44
  • 56

2 Answers2

1

You could make separate solutions and setup build configurations appropriately for each. You would have to maintain both solutions manually, though, from then on.

Alex
  • 3,644
  • 2
  • 19
  • 27
  • Yeah that is what I would like to avoid. – NitroxDM Apr 06 '10 at 22:00
  • I could, however create an interface and then have two implementations. That would minimize the maintaining two projects... – NitroxDM Apr 06 '10 at 22:05
  • According to http://social.msdn.microsoft.com/Forums/en/vsx/thread/f032a9b7-50d5-4459-bd2f-5bfe2d6022c2, we can't expect this from MS but there may be 3rd party tools. – Alex Apr 06 '10 at 22:28
1

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 .Net and .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 .Net build configuration and project C to not build in the .Net CF build configuration.

This enables you to build either a .Net output or a .Net CF output based on the currently selected build configuration, all within one solution, all using the same projects.

Community
  • 1
  • 1
adrianbanks
  • 81,306
  • 22
  • 176
  • 206