C# 如何在不注册的情况下简单地使用旧版 DLL(regsvr32)

How can C# use a legacy DLL simply without registration(regsvr32)(C# 如何在不注册的情况下简单地使用旧版 DLL(regsvr32))

本文介绍了C# 如何在不注册的情况下简单地使用旧版 DLL(regsvr32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况
我运行一个构建系统,它为许多项目执行许多构建.为了避免一个构建影响另一个构建,我们将构建用户锁定到其工作区.构建以非特权用户的身份运行,他们只有对工作区的写入能力.

Situation
I run a build system that executes many builds for many project. To avoid one build impacting another we lock down the build user to only its workspace. Builds run as a non privileged users who only have write ability to the workspace.

挑战
在我们的新构建过程中,我们需要使用通过 COM 公开其接口的旧版 3rdparty DLL.开发团队想要注册构建(regsrv32.exe),但我们的构建安全机制阻止了此活动.如果我们放松制度,那么 3rdparty DLL 将影响其他构建,如果我有两个构建需要两个不同的版本,我可能会针对错误的版本编译错误的构建(非常可能).

Challenge
During our new build we need to use a legacy 3rdparty DLL that exposes its interface through COM. The dev team wants to register the build(regsrv32.exe) but our build security regime blocks this activity. If we relax the regime then the 3rdparty DLL will impact other builds and if I have two build which need two different versions I may have the wrong build compile against the wrong version (a very real possibility).

问题
除了注册来处理通过 COM 公开其接口的旧版 DLL 之外,还有其他选择吗?

Question
Are there any other options besides registration to handle legacy DLLs which expose their interface via COM?

感谢您的帮助

彼得

推荐答案

这里有一个免注册 COM 的演练:

There's a walkthrough on registration-free COM here:

http://msdn.microsoft.com/en-us/library/ms973913.aspx

这里有令人痛苦的细节:http://msdn.microsoft.com/en-us/library/aa376414(该文档的根目录实际上在这里:http://msdn.microsoft.com/en-us/library/dd408052)

And excruciating detail here: http://msdn.microsoft.com/en-us/library/aa376414 (the root of that document is actually here: http://msdn.microsoft.com/en-us/library/dd408052 )

此外,对于一般的构建,您应该能够使用 Tlbimp 或 tlbexp 创建一个可用于构建的 TLB 文件,假设注册点只是为了能够编译成功,而不是运行特定的测试.

Also, for building in general, you should be able to use Tlbimp or tlbexp to create a TLB file that you can use for building, assuming the point of registering is just to be able to compile successfully, and not to run specific tests.

这篇关于C# 如何在不注册的情况下简单地使用旧版 DLL(regsvr32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:C# 如何在不注册的情况下简单地使用旧版 DLL(regsvr32)

基础教程推荐