当“添加为链接”时如何引用 dll在项目中?
我的项目树中有两个 dll 文件(不是引用)。它们作为链接添加,它们是解决方案中其他项目的组件。我正在尝试将其构建操作设置为嵌入式资源,以便我可以将它们导入到 .exe 文件中。我无法编写 using 语句,因此无法在当前项目中引用它们。那怎么办呢?
I have two dll files in the project tree(not the references). They are added as link, they are assemblies of other project in solution. I'm trying to set their Build Action to Embedded Resource, so I can import them to .exe file. I can't write using statement, so I can't reference them in current project. How can that be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加对程序集的硬引用并将其 Copy Local 设置为 False,然后在调用程序集之前将程序集从嵌入式资源提取到应用程序目录。您无法像您想要的那样引用链接(快捷方式)。
要点(在此示例中)和 带有示例代码的博客文章
这是一个工作示例。 (EmbeddedReferenceApplication.exe | 控制台应用程序)
在 EmbeddedReference.dll 中
You need to add a hard reference to the assemblies and set their Copy Local to False, then extract the assemblies from your embedded resources to the application directory before they are invoked. You can't reference a linked (shortcut) like you want.
Key Points (in this example) and the Blog Article with Example Code
Here is a working example. (EmbeddedReferenceApplication.exe | Console Application)
In EmbeddedReference.dll