Search code examples
c#c#-4.0.net-2.0

Targeting different .NET platform with csc.exe 4.0


I had installed .NET 4 on my system and found that the produced exe is using CLR 4.0. Is there an option with the csc.exe to target CLR 2.0?

I am using Notepad++ currently. (SharpDevelop works but I need to know how it works)

Like I can select c# version and .NET version in sharp develop.

Thanks.


Solution

  • You can use /noconfig /nostdlib and then explicitly reference the .NET 2.0 assemblies (in c:\Windows\Microsoft.NET\Framework\v2.0.50727 for example). It looks like the /lib command line option can make this slightly easier by letting you specify a directory to look in for references