0

I need to centralize a library location for all applications running on the machine, so I am including the following section in machine.config file. As per the comments, the machine.config should only contain settings that differ from their defaults. So I erased everything in machine.config and included this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly" culture="neutral" publicKeyToken="fkjdkfjdfkdjfdkf"/>
        <codeBase version="1.2" href="file://C:/libs/myAssembly.dll"/>
     </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Everything works when I include this section in app.config file. But when I move this to machine.config file, I get the following error in the application -

The type initializer for '...' threw an exception. What could be the problem here? Is this the right way to edit machine.config file.

user236215
  • 7,278
  • 23
  • 59
  • 87
  • 1
    When you write "I erased everything in machine.config(...)" it sounds like you deleted everything. There are a lot of defaults in machine.config that should be left alone. Do you have a backup? Try restoring it and then adding in your changes. – Reacher Gilt Oct 29 '12 at 19:16
  • Ignore this question. I thought machine.config should only contain settings that are changing. I assumed the rest it takes from machine.config.default. Incorrect interpretation by me. – user236215 Oct 29 '12 at 19:24
  • yeah, machine.config is really the "default" in many ways. – Reacher Gilt Oct 29 '12 at 19:40

0 Answers0