Determine the C # compiler version used to compile the current program

I am updating the solution from .NET 2.0 to 3.5. One project is a code generator application that compiles and then runs through an event after assembly. When it starts, it generates some code and calls csc.exe to compile the generated code. The way csc.exe is called uses the System.Environment.Version property (which returns the execution version, not the framework version). Therefore, it always ends with the launch of v2.0 csc.exe, and not the v3.5, which I expect.

So, the question is how to determine if the current VS project is targeting v3.5 frameworks?

+3
source share

Source: https://habr.com/ru/post/1724110/


All Articles