Tutorial :Determine C# compiler version used to compile current program


I'm upgrading a solution from .NET 2.0 to 3.5. One of the projects is a code-generator app that is compiled and then executed via a post-build event. When it is run, it generates some code and invokes csc.exe to compile the generated code. The way it determines which csc.exe to invoke is using System.Environment.Version property (which returns the runtime version, rather than the framework version). So it always ends up running v2.0 of csc.exe, rather than v3.5 that I expect.

So the question is how do I detect that the current VS project is targeting v3.5 of the framework?

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »