编译引用的DLL [英] Compile a referenced dll

查看:192
本文介绍了编译引用的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用VS2005和vb.net ... 我有一个项目,是一个API,我创建了一个数据存储。当编译创建api.dll。 我在同一个解决方案,有一个项目引用,当编译将创建wrapper.dll的API项目的第二个项目。这基本上是一个包装的API是特定于应用程序。 当我在其他应用程序中使用wrapper.dll,我必须wrapper.dll和api.dll复制到我的新的应用程序。我怎样才能获得包装项目的api.dll编译成自己,这样我只有一个DLL走动?

Using VS2005 and vb.net ... I have a project that is an api for a datastore that I created. When compiled creates api.dll. I have a second project in the same solution that has a project reference to the api project which when compiled will create wrapper.dll. This is basically a wrapper for the api that is specific to an application. When I use wrapper.dll in that other application, I have to copy wrapper.dll and api.dll to my new application. How can I get the wrapper project to compile the api.dll into itself so that i only have one dll to move around?

推荐答案

@ ,它是在Visual Studio中一个特殊的功能。该过程在此博客条目​​,叫概述共享一个强名称跨项目的密钥文件。这个例子是共享强名称密钥文件,但是只适用于任何类型的文件。

@Jas, it's a special feature in Visual Studio. The procedure is outlined in this blog entry, called "Sharing a Strong Name Key File Across Projects". The example is for sharing strong name key files, but will work for any kind of file.

简单地说,你在你的项目上单击右键,选择添加现有项。浏览到要链接,并突出显示文件或文件的文件(S)的目录。只是击中添加或打开(根据您的Visual Studio版本)的insted的,点击小向下箭头该按钮的右侧。你会看到选项打开或链接文件,如果你使用Visual Studio 2003,或添加或添加为链接与2005年(我不知道2008年)。在任何情况下,选择涉及单词链接了一把。那么你的项目将主要参考文件 - 这将是访问无论从原来的项目其在和你挂到项目中。

Briefly, you right-click on your project and select "Add Existing Item". Browse to the directory of the file(s) you want to link and highlight the file or files. Insted of just hitting "Add" or "Open" (depending on your version of Visual Studio), click on the little down arrow on the right-hand side of that button. You'll see options to "Open" or "Link File" if you're using Visual Studio 2003, or "Add" or "Add as Link" with 2005 (I'm not sure about 2008). In any case, choose the one that involves the word "Link". Then your project will essentially reference the file - it will be accessible both from the original project its was in and the project you "linked" it to.

这是一个方便的方法来创建一个包含wrapper.dll和api.dll的所有功能的组件,但你必须记住每次添加新文件api.dll时间重复此过程(但不wrapper.dll)。

This is a convenient way to create an assembly that contains all the functionality of wrapper.dll and api.dll, but you'll have to remember to repeat this procedure every time you add a new file to api.dll (but not wrapper.dll).

这篇关于编译引用的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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