Click here to Skip to main content
14,699,107 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
How to add app.manifest file in my project.
I am using visual studio 2010.
I have tried to add it in many ways but it didnt work for me.
one of the way i tried is:
1. Right click on the project
2. select Add New Item
3. Select Application Manifest File.
Please help me as i want to add uac setting to application
And another thing is that i want make changes in registry while rumtime of the application but if the uac is enable in windows vista and Windows 7 it throws an exception.
can tackle this problem by add the app.manifest file?
If yes how could i deploy it with my application.exe
Posted
Updated 6-Sep-20 0:10am
Comments
Prasad Khandekar 31-Jul-13 2:19am
   
Please have a look ath this article (http://msdn.microsoft.com/en-us/library/ms235229.aspx)

Regards,
Kashif Alvi 31-Jul-13 6:03am
   
I have done all this but i could not find the "configuration properties" in Project property.
Prasad Khandekar 31-Jul-13 7:18am
   
What really happens when you select Add new Item -> Application Manifest File? Because that's the standard way. Also have a look at this discussion thread (http://stackoverflow.com/questions/4084585/how-to-embed-a-manifest-file-at-compile-time-in-visual-studio-2010)

Regards,
Kashif Alvi 31-Jul-13 10:40am
   
When i click on the add new item a window open up in which on the left side a tree structure is given in which there are categories of the item you want to add.
I searched the whole window i could not 'application manifest file' but i got 'application configuration file' which is already include to my project.

for further detail i can mail you the screen shots but if u provide me your email id.
Thank you
Richard MacCutchan 31-Jul-13 12:26pm
   
I don't know what version of Visual Studio you are using, but with Visual C# Express 2010 I see "Application Manifest File" among the choices. The sample file that is generated also contains all the options for selecting enhanced UAC.
Kashif Alvi 31-Jul-13 13:13pm
   
I am using visual studio 2010
And vb .net as programming language
Richard MacCutchan 1-Aug-13 2:46am
   
I cannot see any reason why you don't get the manifest as an option. Can you upload your screenshots to a sharing site somewhere so we can see exactly what you are seeing?
Kashif Alvi 1-Aug-13 6:48am
   
I have uploaded 5 screen shots please have a look at it:
1. http://imageshack.us/a/img69/2096/9ufq.png
2. http://imageshack.us/a/img199/6567/tlwa.png
3. http://imageshack.us/a/img59/9616/9s8n.png
4. http://imageshack.us/a/img441/2634/hmnb.png
5. http://imageshack.us/a/img22/1474/azi4.png
Richard MacCutchan 1-Aug-13 8:59am
   
Most strange; I guess you will have to do it manually from the information in the link I provided below.

You don't go to Project -> Properties. This stuff goes in the manifest you add to your project!

Right-click your project in Solution Explorer, pick Add, then New Item. In the dialog that shows up, find Application Manifest File and click on it, then click Add. The file will be created in your project under the name app.manifest.

Open that file and make your changes as appropriate.
   
   
Comments
Member 11546513 21-Apr-15 8:31am
   
Hi, I want to enable firewall port programatically in c# asp.net.

web.config code:
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedprivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.

<requestedexecutionlevel level="asInvoker" uiaccess="false">
<requestedexecutionlevel level="requireAdministrator" uiaccess="false">
<requestedexecutionlevel level="highestAvailable" uiaccess="false">

Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->

<requestedexecutionlevel level="asInvoker" uiaccess="false">

</trustInfo>


.cs code:

private void btnfire_Click(object sender, EventArgs e)
{
Process proc = new Process();
string top = "netsh.exe";
proc.StartInfo.Arguments = "Firewall set opmode enable";
proc.StartInfo.FileName = top;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
}
I am getting an error shown in the below line.
Error 8 Unrecognized configuration section trustInfo. C:\Users\MNKPC-02\Documents\Visual Studio 2013\WebSites\FirewallSettings\Web.config 14
Richard MacCutchan 21-Apr-15 8:44am
   
What does that have to do with this question?
In visual studio 2010 I created a new project and added all the forms (only forms) from the old project yo my new project.
Now when every thing is done and all the error are solved i built my project and run it worked fine.
Now as i found on the internet to change the trustinfo from "asInvoker" to "requireAdministrator" in the app.manifest file. I realized that there is no need to open app.manifest from the solution explorer. It is created when invoked for the first time and opened when after that whenever we click on the View Windows Settings button in the project property on the Application tab. Now when the app.manifest file is created which initially looks like this
<asmv1:assembly manifestversion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyidentity version="1.0.0.0" name="MyApplication.app" />
  <trustinfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedprivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedexecutionlevel level="asInvoker" uiaccess="false" />
      </requestedprivileges>
    </security>
  </trustinfo>
  
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->

      <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
      <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
      
    </application>
  </compatibility>
  
  <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
  <!-- <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>-->

</asmv1:assembly>


Just change this line
<requestedexecutionlevel level="asInvoker" uiaccess="false" />

to this
<requestedexecutionlevel level="requireAdministrator" uiaccess="false" /> 

and ur done.
There no need to add any file from any where. It works fine on my visual studio 2010 SP1.
   
v2
Comments
Surreal One 17-Mar-16 14:10pm
   
Hello, everybody.

Is there a way to add a manifest file to Visual C++ 2015 project? I'm currently trying to breath life into a project of mine, which I've stopped to develop at 2003, but the Dave's Kreskowiak solution doesn't seem to work anymore.
Jayanta Modak 1-Apr-19 22:59pm
   
Thanks Sir
download and extract https://github.com/eladkarako/manifest/archive/master.zip,
Optionally edit (using Notepad++ or Notepad2 only) the default manifest (generic.manifest),
there are several examples provided. Make sure to always have Windows-EOL (\r\n) and one space-character before the end of the line, do not use TAB-characters.

Drag and drop your exe or dll over add_manifest.cmd,
it will override the embedded, existing manifest content with the content of generic.manifest).

You can also use side-by-side manifest,
which is a manifest file placed in the same folder as the exe.
Drag and drop the exe/dll over copy_manifest.cmd for an easier copy (you can also copy generic.manifest manually).

Note that side-by-side manifest means nothing if there is an already embedded manifest in the exe/dll, since by default Windows will always prefer the embedded manifest first over a manifest file in the same folder.

To change Windows preference of side-by-side manifest to favor an external file over the embedded-manifest in the exe,
you need to apply a registry fix, and restart your computer.
registry fix for preferring a side-by-side over embedded resource.

You can also delete the embedded manifest.
You can manipulate embedded data (of dot.net apps as well) with http://www.angusj.com/resourcehacker/#download, although I advise against editing the manifest itself with it and use the provided solution instead which uses the official mt.exe - Microsoft Manifest Tool (which preserves the manifest file content such as whitespace, and writes the binary block resources properly. If you use resource-hacker to edit the manifest you might end up with a corrupt embedded-manifest (..sort of stuff that can drive you crazy), but you can safely delete the manifest embedded-resource with it if you wish to.
   
Comments
OriginalGriff 6-Sep-20 5:30am
   
While I applaud your urge to help people, it's a good idea to stick to new questions, rather than 7 year old ones. After that amount of time, it's unlikely that the original poster is at all interested in the problem any more!
Answering old questions can be seen as rep-point hunting, which is a form of site abuse. The more trigger happy amongst us will start the process of banning you from the site if you aren't careful. Stick to new questions and you'll be fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900