Click here to Skip to main content
15,889,176 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 5-Sep-20 23:10pm
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.

 
Share this answer
 
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?
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.
 
Share this answer
 
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
XML
<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
XML
<requestedexecutionlevel level="asInvoker" uiaccess="false" />

to this
XML
<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.
 
Share this answer
 
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

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