I am using .NET4.0, but for compatability reasons, I’d like to compile to a .NET2.0 dll from c#. There should be no .NET4.0 specific functionality used in the script, so it should run fine in a .NET2.0 environment. Is there some commandline syntax on the csc that I can specify a version number with?
Share
You mentioned
csc.exe, so I’m assuming that you won’t be building with Visual Studio, but rather, by command line. Also, I’m assuming thatmsbuildis not available on the build machine.I believe that
csc.exeis specific to each version. For example, in the folderC:\WINDOWS\Microsoft.NET\Framework\v4.0.30319, you will findcsc.exe, and in the folderC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, you will find another version ofcsc.exe.To build a .NET 2.0 dll, you should reference the
csc.exefrom the v2.0 folder (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).Cheers!