如何在我的项目中添加清单文件 [英] How to add a manifest file in my project

查看:144
本文介绍了如何在我的项目中添加清单文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的项目中添加app.manifest文件。

我正在使用visual studio 2010.

我试图以多种方式添加它但它没有工作对我而言。

我尝试的方式之一是:

1.右键单击项目

2.选择添加新项

3.选择应用程序清单文件。

请帮助我,因为我想将uac设置添加到应用程序

另一件事是我想要进行更改在注册表中,虽然应用程序朗姆酒,但如果在Windows Vista和Windows 7中启用uac它会引发异常。

可以通过添加app.manifest文件来解决这个问题吗?

如果是,我怎么能用我的application.exe部署它

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

推荐答案

你没有去Project - >属性。这些东西放在你添加到项目中的清单中!



在解决方案资源管理器中右键单击你的项目,选择Add,然后选择New Item。在显示的对话框中,找到Application Manifest File并单击它,然后单击Add。该文件将在您的项目中以名称 app.manifest 创建。



打开该文件并制作您的文件适当更改。
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.


请参阅 http://msdn.microsoft。 com / en-us / library / bb756929.aspx [ ^ ]。


在visual studio 2010中,我创建了一个新项目,并在我的新项目中添加了旧项目中的所有表单(仅表单)。 />
现在当所有事情都完成并且所有错误都解决了我构建我的项目并运行它工作正常。

现在我发现在互联网上更改来自asInvoker的trustinfo在app.manifest文件中torequireAdministrator。我意识到没有必要从解决方案资源管理器中打开app.manifest。它是在第一次调用时创建的,每当我们单击Application选项卡上project项目属性中的View Windows Settings按钮时打开它。现在,当创建最初看起来像这样的app.manifest文件时

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这个


to this

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



和你完成。

无需从任何地方添加任何文件。它在我的visual studio 2010 SP1上工作正常。


and ur done.
There no need to add any file from any where. It works fine on my visual studio 2010 SP1.


这篇关于如何在我的项目中添加清单文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆