简体   繁体   English

用C#安装项目注销COM dll

[英]Unregistering COM dll with a C# Setup Project

I've been stuck on this one for a while. 我已经坚持了一段时间。 I'll try explain in the simplest terms and at the best of my knowledge. 我将尽我所能尝试用最简单的术语进行解释。 I will honour any help. 我将竭尽所能。

I've got a C# project which uses a VB6 compiled ActiveX DLL that I'm constantly updating. 我有一个C#项目,该项目使用我不断更新的VB6编译的ActiveX DLL。 I compile the setup project, send it to the client and they run the setup. 我编译安装项目,将其发送到客户端,然后他们运行安装程序。 When building the updated setup project, I would increase the 'Version' of the setup project so it wouldn't bother with 'Another version is already installed'. 在构建更新的安装项目时,我将增加安装项目的“版本”,以免被“已安装另一个版本”所困扰。

What started happening after a few updates I began to notice the DLL would not be updated to the new version in the installer. 几次更新后开始发生的事情我开始注意到DLL不会在安装程序中更新为新版本。 The client computer had the original DLL both installed and registered. 客户端计算机已安装并注册了原始DLL。 First symptom: method not found exceptions from the client C# code. 第一个症状:从客户端C#代码找不到方法异常。

This is not a shared DLL and only this application needs it. 这不是共享的DLL,仅此应用程序需要它。

I've noticed that when uninstalling the application (through the usual procedure) the DLL is also not removed from the application folder although I would set this file's property 'Permanent' to false. 我注意到,(通过常规过程)卸载应用程序时,虽然我会将此文件的属性“ Permanent”设置为false,但DLL也并未从应用程序文件夹中删除。 The registration entries in the registry are mantained also. 注册表中的注册条目也将保留。

I do update in VS6.0 the version of the DLL (usually increase the build number) before building it. 我确实在VS6.0中更新DLL的版本(通常会增加内部版本号),然后再进行构建。 Then in VS2008, I remove it from the References, and add it again from the 'Browse tab', without re-registering it on my dev machine and adding it from the COM tab. 然后在VS2008中,我将其从“引用”中删除,然后从“浏览”选项卡中再次添加,而无需在我的开发机上重新注册它并从“ COM”选项卡中添加它。

I've thought of these options. 我想到了这些选择。

  • Custom step in Setup project to regsvr32.exe /u 'hardcoded path of my dll' at uninstall (ugly) 卸载时在Setup项目中将regsvr32.exe / u'我的dll的硬编码路径'中的自定义步骤(丑陋)
  • Somehow find out how the 'Isolate' property can work for me without registering 不知不觉中发现了“隔离”属性如何为我工作而无需注册
  • Find out how to execute setup project 'Conditions' that would actually check the version of the library and to update the file accordingly at every install) 了解如何执行安装程序“条件”,该条件将实际检查库的版本并在每次安装时相应地更新文件)

Any help would be incredibly welcome. 任何帮助都将受到极大欢迎。

Out of curiosity? 出于好奇? Why not try using WiX? 为什么不尝试使用WiX? http://wixtoolset.org/ http://wixtoolset.org/

It's great for building installers and you can do this stuff as easily as : 这对于构建安装程序非常有用,您可以像以下操作一样轻松地进行操作:

<File Id="guifreak3" Name="Guifreaks.NavigationBar.XmlSerializers.dll" Source="$(var.Plex.MobileHub.Client.Interface.TargetDir)Guifreaks.NavigationBar.XmlSerializers.dll"/>

Wix will automatically remove the dll when it is uninstalled. 卸载后,Wix会自动删除该dll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM