How to target multiple versions of .NET Framework from MSBuild?

Posted by McKAMEY on Stack Overflow See other posts from Stack Overflow or by McKAMEY
Published on 2010-05-27T17:02:07Z Indexed on 2010/05/30 17:12 UTC
Read the original article Hit count: 384

Filed under:
|
|
|
|

I am improving the builds for an open source project which currently supports .NET Framework v2.0, v3.5, and now v4.0. Up until now, I've restricted myself to v2.0 to ensure compatibility, but with VS2010 I am interested in having real targeted builds.

I'm looking for some guidance on how to edit the MSBuild csproj/sln to be able to cleanly produce builds for each target. I'm willing to have complexity in the csproj and in a batch file to control the build.

My goal is to be able to have a command line script that could produce the builds without needing Visual Studio installed, but only the necessary .NET Framework(s). Ideally, I'd like to minimize dependencies on additional software. I notice that a lot of people use NAnt (e.g. Ninject builds many targets with NAnt) but I'm unsure if this is necessary or if they are just more familiar with it.

I'm pretty sure this can be done but am having trouble finding a definitive guide on setting it up and best practices.

Bonus: my next step after getting this set up will be to better support Mono Framework. Any help on doing this same thing for Mono would be much appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about best-practices