Configurationthe act of modifying the settings for an assemblyis becoming an essential part of .NET development. The .NET Framework 1.1 Configuration Utility provides a means of configuring the assemblies on your system in different ways. This article explains why assemblies require configuration, shows how to use the .NET Framework 1.1 Configuration Utility to perform the task, and explores an alternative you can try in some cases.
For simplicity, I'll refer to the .NET Framework 1.1 Configuration Utility in this article as the .NET Configuration tool.
Why Does Your Application Need Configuration?
One of the original promises of the .NET Framework is that assemblies wouldn't require any configurationthey'd contain the code required for self-configuration. Unfortunately, reality is different from what Microsoft planned. No matter what kind of application you create, the variances between platforms will always require the flexibility that configuration provides. In addition, as Microsoft improves security in products such as Windows XP, the need for security configuration increases because code entries alone might not define the security picture completely.
You actually have several forms of configuration at your disposal. For example, you could create a CONFIG file with the same name as the executable to hold special settings for the assembly. An executable with the name MyDemo.EXE would use a configuration file with the name MyDemo.EXE.CONFIG. The most common uses for such configuration files are to define a specific version of the .NET Framework or to hold special settings that the executable uses for configuration.
The CONFIG file relies on XML. Here's an example of one kind of CONFIG filethis one defines the version of the .NET Framework required to run the application:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <requiredRuntime version="v1.0.3705" safemode="true"/> </startup> </configuration>
Unfortunately, CONFIG files are brittle because a user could easily change or erase the file. Consequently, a second form of configuration is requiredone that the user can't access without permission. The .NET Configuration tool provides a means of configuring applications that's less brittle and definitely under administrator control. In addition, it provides access to some types of configuration that aren't available when using the CONFIG file.