简体   繁体   English

Windows / .net是否在任何情况下都会自动将DLL放入GAC中

[英]Does Windows/.net put DLLs in the GAC automatically under any circumstances

I have a program which references a DLL. 我有一个引用DLL的程序。 Code in this DLL gets the directory of the executing DLL and uses that to look for an XSD file to load (ie I expect the code to be executing from c:\\foo\\my.dll so it looks for c:\\foo\\validation.xsd ). 此DLL中的代码获取正在执行的DLL的目录,并使用该目录查找要加载的XSD文件(即,我希望代码从c:\\ foo \\ my.dll中执行,因此它查找c:\\ foo \\ validation .xsd )。

On of the thousands of customer installations I have this works fine. 在成千上万的客户安装中,我的工作正常。 However in one case the DLL is being installed in the GAC. 但是,在一种情况下,DLL已安装在GAC中。 This means that when it looks for the XSD file it can't find it as the executing directory it is given is that of the GAC rather than c:\\foo. 这意味着当寻找XSD文件时,找不到它,因为它的执行目录是GAC而不是c:\\ foo。

My question is: Is this a feature of Windows/.net which is causing it to be installed in the GAC under some circumstances? 我的问题是:Windows / .net的功能是否在某些情况下导致将其安装在GAC中? The installer clearly isn't putting the DLL in the GAC as a matter of course otherwise I would have this problem showing up all over the place. 当然,安装程序显然不会将DLL放入GAC中,否则我将在所有地方出现此问题。

I have search Stackoverflow and Google and while there is plenty of information on installing and removing files from the GAC I can't find anything which says that this can happen automatically. 我搜索过Stackoverflow和Google,虽然有很多关于从GAC安装和删除文件的信息,但我找不到任何可以自动发生的信息。 I wonder whether an administrator at the customer site is putting these DLLs in there manually. 我想知道客户现场的管理员是否手动将这些DLL放在那里。 It seems unlikely that they would bother but you never know what users will do! 他们似乎不太可能打扰,但您永远不知道用户会做什么!

Thanks, 谢谢,

Xanthalas Xanthalas

I don't believe it happens automatically, but if a separate application which uses the same dependency has registered it in the GAC, that could explain what you're seeing. 我不相信它会自动发生,但是如果使用相同依赖项的单独应用程序已经在GAC中注册了它,那可以解释您所看到的内容。 In that case the user may not have done anything with the DLL deliberately or knowingly. 在那种情况下,用户可能没有故意或有意对DLL做任何事情。

Someone would have installed the assembly in the GAC, probably using Gacutil . 有人可能会使用Gacutil在GAC中安装了该程序集。

Assemblies do not install themselves in the GAC. 程序集不会自行安装在GAC中。

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

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