C# and native resources

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl Daniel [VC++ MVP]

    C# and native resources

    Problem: C# 2.0 doesn't imbed a UAC manifest in the EXE files that it
    produces.
    Problem: The suggested solution on MSDN is unworkable (manually opening the
    EXE using VS as a resource editor and inserting the manifet resource).
    Problem: Changing the C# project to explicitly link a .RES file suppresses
    the generation of the native VS_VERSIONINFO resource by the C# compiler.

    All in all, MS made it harder than necessary to produce a Vista-compliant
    EXE from C# 2.0.

    So how have people solved this problem?

    It seems like some kind of command-line tool to insert the manifest resource
    after the fact would be a good solution - there are a variety of such tools
    on that market, all of which seem overpriced for such a simple task.

    Any free tools out there that can insert a manifest resource into an
    existing EXE?

    -cd


  • Willy Denoyette [MVP]

    #2
    Re: C# and native resources

    "Carl Daniel [VC++ MVP]" <cpdaniel_remov e_this_and_nosp am@mvps.org.nos pam>
    wrote in message news:e4gEk6obIH A.5900@TK2MSFTN GP02.phx.gbl...
    Problem: C# 2.0 doesn't imbed a UAC manifest in the EXE files that it
    produces.
    Problem: The suggested solution on MSDN is unworkable (manually opening
    the EXE using VS as a resource editor and inserting the manifet resource).
    Problem: Changing the C# project to explicitly link a .RES file
    suppresses the generation of the native VS_VERSIONINFO resource by the C#
    compiler.
    >
    All in all, MS made it harder than necessary to produce a Vista-compliant
    EXE from C# 2.0.
    >
    So how have people solved this problem?
    >
    It seems like some kind of command-line tool to insert the manifest
    resource after the fact would be a good solution - there are a variety of
    such tools on that market, all of which seem overpriced for such a simple
    task.
    >
    Any free tools out there that can insert a manifest resource into an
    existing EXE?
    >
    -cd
    >
    >

    Carl, the Windows SDK comes with a tool called the "Microsoft (R) Manifest
    Tool" the PE file is: mt.exe.

    You can use this tool to embed a manifest in a post build step in VS2005.
    VS2008 supports this by default, see the project settings.

    Willy.


    Comment

    • Carl Daniel [VC++ MVP]

      #3
      Re: C# and native resources

      "Willy Denoyette [MVP]" <willy.denoyett e@telenet.bewro te in message >
      Carl, the Windows SDK comes with a tool called the "Microsoft (R) Manifest
      Tool" the PE file is: mt.exe.
      >
      You can use this tool to embed a manifest in a post build step in VS2005.
      VS2008 supports this by default, see the project settings.
      OK, I wondered if mt.exe could do what I need. I'll take a look at the docs
      for it. Glad to hear that they got this sorted out in VS2008 - it's a bit
      of a pain in VS2005.

      -cd


      Comment

      • Carl Daniel [VC++ MVP]

        #4
        Re: C# and native resources

        So far, nothing but disaster. I tried a different manifest fragment using
        the v2 schema. That is acceptable to mt.exe, but the resulting EXE file
        doesn't run, failing with "Configurat ion System Failed to Initialize".
        That's after re-signing the EXE with sn.exe too.

        Can anyone post a simple, complete example of embedding a manifest in a C#
        exe file that's sufficient to let the app run 'asInvoker' on Vista?

        -cd


        Comment

        • Carl Daniel [VC++ MVP]

          #5
          Re: C# and native resources

          Willy Denoyette [MVP] wrote:
          Here's a KB article describing an alternate solution:
          http://support.microsoft.com/kb/944276
          Yeah, I'd found that one previously. Not a very automatable solution. I'll
          stick with the post-build step. It does the job and it's all integrated
          into my FinalBuilder-based product build.

          -cd


          Comment

          Working...