.NET Embedded Manifest Crashes XP

Posted by Alan Spark on Stack Overflow See other posts from Stack Overflow or by Alan Spark
Published on 2010-03-13T20:07:36Z Indexed on 2010/03/13 20:15 UTC
Read the original article Hit count: 172

Hi,

I am embedding a manifest in a .NET exe so that it can request elevated permissions in Vista and Windows 7. The manifest that I am using is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"  name="ElevationTest" type="win32"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

It works as expected in Vista and Windows 7 but crashes XP with the standard "... has encountered a problem and needs to close..." error. If I don't embed any manifest then it works as expected but will obviously not have the required permissions in Vista and Windows 7.

What is a standard way of producing an exe that will function with the correct permissions in XP and Vista / Windows 7?

Thanks, Alan

© Stack Overflow or respective owner

Related posts about .NET

Related posts about windows-vista