Ian*_*oyd 30 fusion manifest visual-studio-2010
如何将程序集清单添加到.NET可执行文件中?
程序集清单是一个XML文件,它添加到具有资源类型RT_MANIFEST(24)的.NET可移植可执行程序(PE )中.
程序集清单用于声明有关可执行文件的许多内容,例如:
如果我想禁用DPI扩展,因为我是一个优秀的开发人员:
<!-- We are high-dpi aware on Windows Vista -->
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
Run Code Online (Sandbox Code Playgroud)我可以声明我是在Windows 7上设计和测试的,我应该继续依赖Windows 7中的任何错误
<!-- We were designed and tested on Windows 7 -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
Run Code Online (Sandbox Code Playgroud)我可以声明我是一个优秀的开发人员,不需要文件和注册表虚拟化
<!-- Disable file and registry virtualization -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
Run Code Online (Sandbox Code Playgroud)我可以声明我依赖于Microsoft Common Controls库的特定版本6 :
<!-- Dependency on Common Controls version 6 -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"/>
</dependentAssembly>
</dependency>
Run Code Online (Sandbox Code Playgroud)我可以声明我依赖于特定版本的GDI +:
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.GdiPlus" version="1.0.0.0" processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
Run Code Online (Sandbox Code Playgroud)在过去,我们将创建一个资源脚本文件(*.rc),例如:
wumpa.rc
1 24 AssemblyManifest.xml
Run Code Online (Sandbox Code Playgroud)
将该文件添加到项目中,编译器将编译该.rc文件; 包括最终可执行映像中的资源.
除了Visual Studio 2010似乎没有办法将资源脚本文件添加到项目中.
如何在Visual Studio 2010中向项目添加资源脚本?
如何在Visual Studio 2010中向项目添加程序集清单?
注意:任何解决方案都必须在具有源代码控制和多个开发人员的环境中工作(例如,可能未安装二进制文件的硬编码路径将破坏构建并且不起作用).
更新:迈克尔·福克斯认为,可用于包括集清单项目属性对话框,但他并不表示其中:

更新:我尝试过的事情:
Embed manifest with default settings:不起作用,因为它嵌入了默认设置的清单,而不是我的设置.
在Manifest下,将组合选项更改为Create application without a manifest:

不起作用,因为它没有嵌入任何清单
在资源下,选择资源文件单选选项:

不起作用,因为您无法选择程序集清单(或包含程序集清单的资源脚本)
在" 资源"下,选择" 资源文件"单选选项,然后输入程序集清单XML文件的路径:
不起作用,因为Visual Studio在使用程序集清单时会出现阻塞:
不起作用,因为Visual Studio在使用资源脚本时会出现阻塞:
添加AssemblyManifest.xml到我的项目,然后在Manifest组合框中查找它:

不起作用,因为Assembly Manifest文件未列为选项
我有十几个其他东西我可以保持截图(在解决方案中添加一个.rc文件,在下拉列表中查找它,选择"no manifest"并将
wumpa.rc构建操作更改为各种内容,.rc使用单独的资源编译器构建文件,手动或预构建/ msbuild步骤,并选择该.res文件作为我的资源).我将停止为我的问题增加额外的批量,并希望得到答案.
Cod*_*ray 26
如果要将自定义信息添加到应用程序的清单中,可以按照以下步骤操作:
这会添加一个以app.manifest项目命名的文件,您可以根据需要打开和修改该文件.
在MSDN上宣布托管应用程序为DPI-Aware时,屏幕截图显示了类似的步骤:
在解决方案资源管理器中,右键单击项目,指向" 添加",然后单击" 新建项".
在" 添加新项"对话框中,选择" 应用程序清单文件",然后单击" 添加".出现app.manifest文件.

将以下文本复制并粘贴到app.manifest文件中,然后保存.
<?xml version="1.0" encoding="utf-8"?>
<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"/>
<!-- Disable file and registry virtualization. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<!-- <requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
-->
</requestedPrivileges>
</security>
</trustInfo>
<!-- We are high-dpi aware on Windows Vista -->
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<!-- Declare that we were designed to work with Windows Vista and Windows 7-->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<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>
Run Code Online (Sandbox Code Playgroud)在解决方案资源管理器中,右键单击项目,然后单击" 属性"以验证是否使用了app.manifest.

您的应用程序现在表现为"为Windows设计",并且是
我安装了Service Pack 1的Visual Studio 2010 Professional.我在Windows 7旗舰版64位上运行.如果我按照这些说明操作,项目属性会在资源块中显示"使用默认设置嵌入清单",并且该选项也会被禁用!当我构建时,清单不会嵌入到DLL中,因为我通过在资源视图中打开DLL来验证.
但是,如果我:
清单文件是正确嵌入的,我可以通过将DLL加载到资源视图来验证."应用程序"属性中的"清单"设置仍显示为"使用默认设置嵌入清单",但仍处于禁用状态.
| 归档时间: |
|
| 查看次数: |
42519 次 |
| 最近记录: |