通过 %PATH% 环境的程序集 searchPath
我正在开发一个项目,想要将共享程序集与项目文件夹分开,
+ Program Files
+ My Company
+Commons
* Assembly1.dll
* Assembly2.dll
* Assembly3.dll
* Assembly4.dll
+Project1
* MyProject1.exe
* MyProject1.exe.config
+Project2
* MyProject2.exe
* MyProject2.exe.config
试图使项目从“Commons”文件夹加载程序集,因此我更改系统%PATH%环境来搜索DLL。
%PATH% = c:\Program files\My Company\Commons;%PATH%
但他们不查找路径环境(使用 ProcessMonitor 进行监控) 任何人都可以告诉我如何定义 %PATH% 环境中程序集的搜索路径。
I am developing a project and want to seperate the shared assemblies form project folder
+ Program Files
+ My Company
+Commons
* Assembly1.dll
* Assembly2.dll
* Assembly3.dll
* Assembly4.dll
+Project1
* MyProject1.exe
* MyProject1.exe.config
+Project2
* MyProject2.exe
* MyProject2.exe.config
trying to make projects load assemblies from "Commons" folder so i change the system %PATH% environment to search for DLLs.
%PATH% = c:\Program files\My Company\Commons;%PATH%
but they dont look up the Path environment (Monitoring with ProcessMonitor)
Can anybody show me the way how to define search path for assemblies from %PATH% environment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当应用程序启动时,在
AppDomain.AssemblyResolve
事件中进行搜索以查找 dll。有关该活动的更多信息,请访问:http://msdn.microsoft。 com/en-us/library/system.appdomain. assemblyresolve.aspxDo the search in the
AppDomain.AssemblyResolve
event to find the dlls when your application is starting. More information about the event here: http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx我不相信 dotNET 在绑定程序集时依赖路径环境变量。
请参阅http://ondotnet.com/pub/a/dotnet/ 2003/03/17/bindingpolicy.html 用于 dotNET 绑定策略。
特别是,您可能会发现该元素在这里很有用:
http://msdn.microsoft.com/en -us/library/efs781xb%28v=VS.100%29.aspx
I don't believe dotNET relies on path environment variable when binding assemblies.
See http://ondotnet.com/pub/a/dotnet/2003/03/17/bindingpolicy.html for a dotNET binding policy.
Especially, you might find the element useful here:
http://msdn.microsoft.com/en-us/library/efs781xb%28v=VS.100%29.aspx