R – UAC: Manifest file is ignored

manifestuacwindows-server-2008windows-vista

One of my Executables writes some configuration into a XML file to C:\Program Files\MyApp\config.xml. It needs to run as Administrator on Vista / Server 2008, otherwise the OS won't let it write to that location.

I included a manifest file named config.exe.manifest, to automatically request administration rights at launch.

Here's my manifest file:

<?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="requireAdministrator" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

I tried this on Windows Server 2008, but the manifest file seems to be ignored and the executable is launched without sufficient rights.

Best Answer

http://blogs.msdn.com/junfeng/archive/2009/05/11/internal-manifest-vs-external-manifest.aspx

quoted from above link: In Windows XP, Sxs searches external manifest before internal manifest. If an external manifest is found, the internal manifest is ignored.

In Windows Server 2003 and later, the order is reversed. Internal manifest is preferred over external manifest.

If you use external manifest, and your scenario works in Windows XP, but not Windows Server 2003 and later, please double check the executable does not have an internal manifest