Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET SupportedRuntime in App.config

Tags:

c#

.net

I am compiling a c# application targeting .NET 3.5 as the runtime

In the app.config I am specifying , the recommended supported version tag for 3.5 as per http://msdn.microsoft.com/en-us/library/w4atty68.aspx

What will happen if a computer does not have version .NET 3.5 given I specify .NET 2.0 as the SupportedRuntime ?

Cheers Scott

like image 586
Scottf007 Avatar asked Feb 24 '11 18:02

Scottf007


People also ask

What is SKU in app config?

A string value that specifies the stock-keeping unit (SKU), which in turn specifies which . NET Framework release this application supports.

Where is .NET app config?

The machine configuration file, Machine. config, contains settings that apply to an entire computer. This file is located in the %runtime install path%\Config directory.

How do you check if .NET framework is installed?

The version of .NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Full subkey is missing, then .NET Framework 4.5 or above isn't installed.


2 Answers

Version 3.5 is basically version 2.0 of the CLR. Regardless of what you define, if you have used any of the features of .NET 3.5 or 3.0 on a machine which has only version 2.0, you will get an error.

Value of the version will be the same for 2.0, 3.0, 3.5 and 3.5 SP1:

<configuration>
   <startup>
      <supportedRuntime version="v2.0.50727"/>
   </startup>
</configuration>
like image 159
Aliostad Avatar answered Oct 01 '22 19:10

Aliostad


The SupportedRuntime version lists the CLR version, not the framework version. You use v2.0.50727 for any .NET framework version between 2.0 and 3.5 SP1.

Your app will bomb with a FileNotFound exception when you use an assembly that's only available in 3.0 or 3.5 and you try to run it on 2.0. Including the 3.5 bootstrapper in a Setup project (added by default) is a simple way to avoid this mishap.

like image 35
Hans Passant Avatar answered Oct 01 '22 19:10

Hans Passant