Monday 25 November 2013

Targeting a Specific .NET Runtime using the Startup Settings Schema

This post highlights the power of the startup element in an app.config or web.config file. It is a must-know knowledge for any .NET aficionado.

The startup settings in an app.config or web.config file specify which CLR should be used to run the system.

The aforementioned settings appear in an element called simply startup. Within startup, we have two possible entries, one of which is deprecated.

The element includes the supportedRuntime and requiredRuntime elements. Each element has a version and SKU (from "stock keeping unit" in inventory management). The requiredRuntime is actually, to all intents and purposes, deprecated, and not meant to be used for .NET versions other than 1.0.

Note that if you have a configSections element in your configuration, this will need to come before the startup settings element.

Sometimes, you may see the startup element even at the end of a config file!

More rules regarding the configuration file schema can be found here. Another useful article oriented to .NET 4.5 development is the following.

No comments: