Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compile a project for both .Net 3.5 and 4 at the same time

I need to compile a project for both .Net 3.5 and .Net 4.0. What is the most low-friction way of doing this? If I reference this project from another assembly, how do I determine which runtime is being targeted? Or should I just reference binaries directly?

like image 512
Dmitri Nesteruk Avatar asked Feb 03 '23 15:02

Dmitri Nesteruk


1 Answers

I do this simply by having two csproj files. Then I can set the version, references, build-symbols, etc easily. To avoid having to maintain the file list in both, I use a blanket include - i.e.

I have (in the secondary .csproj):

<Compile Include="..\TheMainProject\**\*.cs" />

This says "compile all .cs files in and under ..\TheMainProject".

like image 84
Marc Gravell Avatar answered Feb 05 '23 03:02

Marc Gravell