Creating a Safe Mode Configuration File
This default version policy might be fine most of the time, but what if you need to specify that the Personalapplication run only with the version that it shipped with? This is where XML configuration files come in. These files have the same name as the application and reside in the same folder. When the application is executed, the configuration file is read and .NET then uses the XML tags therein to dictate which version of a referenced assembly to use.
To specify that an application should always use the version of an assembly that it shipped with, you specify that you want the application's binding mode to be "safe". This is sometimes colloquially referred to as putting the application in safe mode. To test this, create a file called PersonalAccounting.cfg in the Accounting/Personal folder and modify it such that it appears as follows. Take note of the <AppBindingMode> tag.
<?xml version ="1.0"?> <Configuration> <BindingMode> <AppBindingMode Mode="safe"/> </BindingMode> </Configuration>
Now, if you run the Personalapplication again, you'll see the following output: -
PersonalAccounting calling Account.PrintVersion This is version 18.104.22.168 of the Account class