I have an assembly that has a lot of old registered versions.
The only dll I have is the last one.
How can I unregister all versions of the assembly?
Thanks.
EDI开发者_Python百科T : I want to do this at runtime so I want something like regasm -u... or some other script-y solution.
EDIT: I'm assuming that there are associated registry entries that you are trying to remove.
Regasm can output a .reg file.
You can use the /regfile option to generate a .reg file that contains the registry entries instead of making the changes directly to the registry. You can update the registry on a computer by importing the .reg file with the Registry Editor tool (Regedit.exe).
If you want to uninstall old versions at runtime, presumably you could:
1) Create a reg file for the current assembly (for reference purposes).
2) Write an application that examined the registry for similar keys (perhaps with different version numbers?)
3) Use regasm to unregister matching assemblies. If necessary, uninstall COM entities with regsvr32.
4) CAREFULLY remove those keys programmatically.
5) Register your new assembly.
6) gacutil the newly registered assembly (if needed).
My COM/Interop is a little rusty, so please leave a comment if this doesn't work.
精彩评论