卸载Windows窗体应用程序时选择dll文件
我使用 C# 编写了一个 Windows 窗体应用程序并创建了安装文件。一切正常。 我的问题是;我们可以选择安装程序中应包含哪些 dll 和 exe 文件,就像我们可以选择应删除哪个 dll 一样,或者至少当我们尝试卸载程序时,它可以询问我们“我是否应该这些...常见的 dll 文件” “? 因为当我卸载它时,它可以删除系统当前使用的常见dll。所以就会出现一个问题。 我在 Visual Studio 中制作了安装文件。
I wrote a windows forms application using c# and created setup file.Everything works fine.
My question is; we can choose which dll and exe file should be included to setup,like that can we choose which dll should be removed or at least when we try to uninstall program, can it ask to us "if I should these ... common dll files" ?
Because when I uninstall it, it can removes common dll s with the system is currently using. So there will be a problem.
I made setup file in visual studio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从表面上看这个问题:您实际上不太可能安装由其他程序共享的 DLL。 VS 构建系统和安装项目向导都会尽力阻止您执行此操作。在 .NET 中执行此操作的唯一有效方法是对程序集进行强命名并将其部署到 GAC 中。非 GAC 方式是实现 AppDomain.AssemblyResolve 事件。如果你真的这样做了,你就会在你的问题中提到这一点。
Winforms 应用程序的正常部署模式是 ClickOnce 或安装程序(如您所做的那样),或者只是复制文件。如果安装后,EXE 和它使用的 DLL 位于同一个目录中,那么您就没有共享任何 DLL。
如果我猜错了,而您实际上正在共享 DLL,那么到目前为止最好的解决方案就是停止这样做。 DLL Hell 没什么可乱的。
Taking this question at face value: it is very unlikely that you are actually installing DLLs that are shared by other programs. Both the VS build system and Setup project wizards try very hard to stop you from doing this. The only effective way to do so in .NET is to strong-name the assembly and deploy it into the GAC. The non-GAC way is to implement the AppDomain.AssemblyResolve event. You would have mentioned that in your question if you actually did this.
The normal deploy mode for a Winforms app is ClickOnce or an installer, like you made, or simply copying the files. If after the install, the EXE and the DLLs it uses are in one directory then you are not sharing any DLLs.
If I guessed this wrong and you actually are sharing DLLs then by far the best solution is to stop doing this. DLL Hell is nothing to mess with.
您可以考虑其他打包软件,例如InstallShield,Visual Studio打包项目不提供此类配置。
you may consider another packaging software like InstallShield, Visual Studio Packaging projects does not offer such kind of configuration.