views:

217

answers:

4

Does anyone know how to switch a compilation of a library project on visual studio, so I can compile for compact framework and full .Net framework?

+4  A: 

You can use two project-files on the shared sources.

So, you may have one solution file and two project on it at the same directory.

Manushin Igor
Great! Thanks for your Answer!
elranu
A: 

I'm pretty sure it appears in your project properties if you have the compact framework installed (just like the choice between versions 2.0-3.5).

HeavyWave
+1  A: 

If you make a .NET CF library it will in most cases also run on the desktop .NET.

You can even make this kind of development a bit easier by following the steps described here. The link will help you set up Visual Studio so that you can compile for .NET CF but deploy to your desktop.

mliesen
A: 

We've looked at making one project compile for both full and compact framework vesrions but in the end it was messy (lots of hacking project files) and we routinely encountered sceneraios where we wanted to include certain files or references in one or the other targets (such as including Smart Device Framework in the compact framework version).

We had solution-related problems when performing test analysis of MSTest unit tests so we now have two separate solutions. Each solution has a tree of mostly the same logical projects - one for compact framework and the other for full framework. It's a bit of maintenance but it has worked reasonably well.

One additional item we needed to manually add to either the full or compact framework project was changing the default intermediate \output path to avoid the project outputs from stepping on each other:

<Project ... >
  <PropertyGroup>
    <BaseIntermediateOutputPath>objCE\</BaseIntermediateOutputPath>
...

Open the .csproj file and add the line to the first <PropertyGroup> element.

More information on the parameter can be found here: http://msdn.microsoft.com/en-us/library/bb629394.aspx

One thing to note is that you will get a security warning when you open the project stating that it has been customized. You can select to load it normally and uncheck the ask me every time option to never see it again.

Jason Morse
I think this is a bit too complicated. As Manushin already mentioned, just make one solution with several projects, using the same source files.
Oliver