Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get manifest file to generate in Visual Studio 2013

I have two projects that were written by others, one is a WPF application and the other a Console application. The WPF application is generating a .exe.manifest file alongside the executable, somehow automatically generated using the project settings (it is not explicitly declared as app.manifest). But the Console application is not generating one. How would I set it up to generate one?

like image 418
Stephen Holt Avatar asked Mar 17 '23 03:03

Stephen Holt


1 Answers

For C/C++ in Visual Studio 2013 I've found 2 ways:

The modern way: Merge in additional XML

  1. Go to (properties) > Linker > Manifest and change Generate Manifest to YES. You can also set UAC / admin rights here without needing to create your own manifest XML.

  2. Add a new XML file to the project, and include other manifest entries that you need inside of an assembly wrapper tag, for example:

    <?xml version="1.0" encoding="utf-8"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
    <!--The ID below indicates application support for Windows 8.1 -->
    <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
    <!-- 10.0 -->
    <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
    </application>
    </compatibility>
    </assembly>
    
  3. Go to (properties) > Manifest Tool > Input and Output and add the XML file from step 2 using the Additional Manifest Files setting

The Manual way: Use a custom RC file

If you add a second RC file that is manually edited to your project you can include a manifest XML file.

  1. Add the RC file to your project
  2. (project) > Linker turn manifest generation OFF since you don't want Visual Studio to create its own manifest at link time.
  3. In the RC file, add these lines

    #define MANIFEST_RESOURCE_ID 1
    MANIFEST_RESOURCE_ID RT_MANIFEST "res\\my-manifest-xml.manifest"
    

For this you need to make sure your XML file includes all tags needed for the manifest.

Testing the results

SigCheck from Systenternals has an -m option that will show you the manifest.

SigCheck - SysInternals - TechNet

like image 160
Dave S Avatar answered May 11 '23 12:05

Dave S