6

I have look completely in this two msdn article C# Compiler Options Listed Alphabetically and C# Compiler Options Listed by Category for compiler option for specifying the target framework version which can be used in command line building. I got to know that we can specify the framework version in app.config with supportedRuntime element.

Can we use this element(configuration>startup>supportedRuntime) in web.config also(in case of asp.net application) ?

I have not needed to do it with only command line switch. I just asking this question only because of curious to know about it.

2
  • 1
    Isn't it determined by the version of the .net framework that you're running CSC from? e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe would compile for .net 4 Commented Mar 7, 2016 at 13:30
  • 1
    You can either specify the full path for the references /reference:C:\Windows\Microsoft.Net\Framework\v2.0.50727\mscorlib.dll or specify the folder for all references like /lib:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5" Commented Mar 7, 2016 at 13:55

1 Answer 1

4

The compiler doesn't care about what version of the framework, only the version of the runtime and the language.

The cl.exe program just compiles and links whatever you throw at it, and it is up to you to add references to .NET 4.5-specific assemblies or not. You can choose to reference older versions of external references by specifically asking for a version using a fully qualified assembly name.

The setting in Visual Studio is just a filter that shows/hides assemblies when you are adding references.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.