Application config file is not used if the application has certain SxS manifest

We discovered a bug internally. Since people may encounter the same problem, I am posting the bug description and the workaround.

 

In Windows Server 2003, if the application has the following SxS manifest, then CLR will not use the application config file even if it exists.

 

<?xml version="1.0" encoding="utf-8"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

    <security>

      <requestedPrivileges>

        <requestedExecutionLevel

          level="asInvoker"

          uiAccess="false"/>

      </requestedPrivileges>

    </security>

  </trustInfo>

</assembly>

 

To workaround the bug, add an assemblyIdentity to the SxS manifest.

 

<?xml version="1.0" encoding="utf-8"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <assemblyIdentity

    version="1.0.0.0"

    name="Foo"

    type="win32"

  />

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

    <security>

      <requestedPrivileges>

        <requestedExecutionLevel

          level="asInvoker"

          uiAccess="false"/>

      </requestedPrivileges>

    </security>

  </trustInfo>

</assembly>

This bug does not exist in Windows XP, or Windows Vista.