如何在 C# 部署中包含文件?
我有一个 DLL,需要与我的 C# 应用程序一起部署。 当我点击“发布”时,它当前未包含在安装包中,那么如何包含它?
如果我有 app.config 和其他想要与我的应用程序一起部署的文件,这个过程会有什么不同吗?
I have a DLL I need to deploy with my C# application. It's not currently included in the installation package when I hit "Publish" so how do I include it?
Would the process be any different if I had app.config and other files I wanted to deploy with my application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果被引用,它应该被自动包含在内。 我已经部署了几个需要第 3 方 dll 的应用程序,并且它们已发布正常。
您的项目中是否正确引用了 dll? 这是我目前唯一能想到的可能是问题的事情,但如果不是的话,您的代码无论如何都不会编译和/或链接。
要部署 xls 文件,您需要做的就是将该文件添加到解决方案,然后在该文件上设置“复制到输出目录”属性。
If it's referenced it should be included automatically. I've deployed a couple of apps that require a 3rd party dll and they've published OK.
Is the dll referenced correctly in your project? That's the only thing I can think of at the moment that might be the problem, but if it wasn't your code wouldn't compile and/or link anyway.
To get the xls file to deploy all you need to do is add the file to the solution and then set the "Copy to Output Directory" property on the file.
我猜你用的是 Visual Studio?
如果您使用的是 Visual Studio 2008(我没有使用 Visual Studio 2005 的经验),请在项目属性的“发布”选项卡下单击“应用程序文件”按钮。 这将显示项目所需的所有依赖项程序集的列表。 如果您发现默认情况下 Visual Studio 发布工具未发布所需的 dll,您可以进入此处并将有问题的 dll 的发布状态设置为包含。
有时,在我更复杂的项目中,根据依赖项的类型,我必须进入此菜单并强制包含某些 dll,而不是默认的先决条件设置。
...但这都是假设您在所需的项目中正确引用了程序集并且一切都编译正常。
I take it you are using Visual Studio?
If your using Visual Studio 2008 (I have no experience with Visual Studio 2005) under the Publish tab in your project properties click on the Application Files button. This will bring up a list of all dependencies assembalies required by your project. If you find that required dll is not being published by the Visual Studio publisher tool by default you can go into here and set the Publish Status of the offending dll to Include.
Sometimes in my more complicated projects, depending on the type of dependency, I have to go into this menu and force certain dll's to be included opposed to the default Prerequsite setting.
...but this is all under the assumption you have the assembly properly referenced in the required projects and everything is compiling fine.
您不能将 dll 作为资源添加到安装程序项目中吗?
Can't you add the dll as a resource to your installer project?