在不使用 GAC 的情况下向 COM 注册托管程序集

1

本文介绍了在不使用 GAC 的情况下向 COM 注册托管程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我想知道是否可以在不向 GAC 注册的情况下向 COM 注册程序集.我们需要使用 CCW 部署一些暴露给经典 asp 的 .net 库.但是部署是一场噩梦.

I'm wondering if it possible to register assemblies with COM without having to register it with the GAC. We need to deploy some .net libraries that are exposed to classic asp using a CCW. But deployments are a nightmare.

推荐答案

是的,使用 regasm.exe/codebase 键.当您使用 regasm.exe 而不使用 /codebase 时,它只会将程序集的文件名写入注册表,因此 .NET 运行时无法找到它,除非程序集位于GAC.使用 /codebase 它将写入完整路径,当使用者调用 CoCreateInstance() 时,.NET 将很高兴找到程序集.

Yeap, use regasm.exe with /codebase key for that. When you use regasm.exe without /codebase it only writes the filename of the assmebly to the registry and so the .NET runtime can't find it unless the assembly is in the GAC. With /codebase it will write the full path and .NET will be happy to find the assembly when the consumer calls CoCreateInstance().

这篇关于在不使用 GAC 的情况下向 COM 注册托管程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14

具有未知类型的 CreateDelegate
CreateDelegate with unknown types(具有未知类型的 CreateDelegate)...
2023-11-11 C#/.NET开发问题
5

Func<T>.BeginInvoke 使用线程池吗?
Does Funclt;Tgt;.BeginInvoke use the ThreadPool?(Funclt;Tgt;.BeginInvoke 使用线程池吗?)...
2023-11-11 C#/.NET开发问题
6

如何为具有空目标的实例方法创建委托?
How to create a delegate to an instance method with a null target?(如何为具有空目标的实例方法创建委托?)...
2023-11-11 C#/.NET开发问题
6