【发布时间】:2012-08-02 18:30:35
【问题描述】:
我使用教程(http://support.microsoft.com/kb/837908,方法 1)生成了两个项目。项目 a 引用了项目 b。
项目a:
new System.EnterpriseServices.Internal.Publish().GacRemove(string.Format(@"C:\Users\[me]\Documents\Visual Studio 2010\Projects\MyAssembly1\MyAssembly1\bin\Debug\MyAssembly1.dll"));
new System.EnterpriseServices.Internal.Publish().GacInstall(string.Format(@"C:\Users\[me]\Documents\Visual Studio 2010\Projects\MyAssembly1\MyAssembly1\bin\Debug\MyAssembly1.dll"));
MyAssembly1.Class1 obj1 = new MyAssembly1.Class1();
MessageBox.Show(obj1.HelloWorld());
项目 b:
public string HelloWorld()
{
return "1";
}
当我执行以下操作时:
将项目 b 中的“HelloWorld”方法更改为返回“2”(而不是“1”)。
构建项目 b
构建项目 a 并运行它
我收到带有“1”作为文本的消息框,而 GAC 并不总是自行更新。
更新项目 b 并在项目 a 上查看的最简单方法是什么?
【问题讨论】:
-
这似乎是错误的。您不应该在同一进程中安装到 GAC。
-
很奇怪 GacRemove() 采用文件系统路径。它应该采用程序集名称,包括版本。嗯,这是一种失败模式。
标签: c# dll private gac .net-assembly