如何将清单添加到.NET DLL? [英] How to add manifest to a .NET DLL?

查看:162
本文介绍了如何将清单添加到.NET DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个c#类库项目,使用系统上注册的COM DLL。我现在想将COM dll部署为并排程序集,因此我不必注册它,或者干扰可能使用不同版本的dll的其他应用程序。



我已经使用添加新项目菜单将app.manifest添加到c#项目,但我不知道下一步该怎么做。在项目属性/应用程序/图标和清单中,清单下拉列表被禁用。我不知道怎么过去。我已经添加了一个清单文件,为什么不在下拉列表中?



我有一个用于C DLL应用程序的COM DLL的清单,我想我保持原样。现在我需要知道如何编辑c#项目的app.manifest。我将首先添加一个已知的好的依赖元素。但是我需要一个关于如何设置这个的教程,我没有看到它覆盖任何地方。



我正在使用VS2008

解决方案

你绝对可以在.net dll中嵌入一个清单。应用程序清单的内容并不都适用于程序集,但有些则可以使用。例如,UAC条目对组件清单没有意义,但是assemblyIdentity是有意义的。



使用MT.EXE工具,您可以将清单嵌入到dll :



嵌入:

  mt.exe -manifest filename.dll .manifest -outputresource:filename.dll;#2 

提取:

  mt.exe -inputresource:filename.dll;#2 -out:filename.dll.extracted.manifest 
/ pre>

以下是相关信息的更多链接:



另一个dll嵌入示例: http://msdn.microsoft.com/en-us/library/ms235591 (v = VS.100).aspx



SxS演练: http://msdn.microsoft.com/en-us/library/ms973915.aspx


I have a c# class library project that uses a COM dll registered on the system. I now want to deploy the COM dll as a side-by-side assembly, so I don't have to register it, or interfere with other applications that might use a different version of the dll.

I have added app.manifest to the c# project using the add new item menu, but I'm not sure what to do next. In the project properties/application/icon and manifest, the manifest drop down is disabled. I don't know how to get past that. I've added a manifest file, why is it not in the dropdown list?

I have a manifest for the COM dll that works with C++ applications, and I think I keep that as is. Now I need to know how to edit the app.manifest for the c# project. I will start by adding a known good dependency element. But I need a tutorial on how to set this up, I don't see it covered anywhere.

I am using VS2008

解决方案

You definitely can embed a manifest in a .net dll. The contents of an application manifest do not all apply to an assembly, but some do. For example, the UAC entries don't make sense for a component manifest, but assemblyIdentity does.

Using the MT.EXE tool, you can embed a manifest into a dll:

Embed:

mt.exe -manifest filename.dll.manifest -outputresource:filename.dll;#2

Extract:

mt.exe -inputresource:filename.dll;#2 -out:filename.dll.extracted.manifest

Here are more links on related info:

Another dll embed example: http://msdn.microsoft.com/en-us/library/ms235591(v=VS.100).aspx

A SxS walkthrough: http://msdn.microsoft.com/en-us/library/ms973915.aspx

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

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