.NET如何找到我正在使用的命名空间的dll? [英] How does .NET locate the dll of the namespace I'm `using`?

查看:58
本文介绍了.NET如何找到我正在使用的命名空间的dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET如何找到我正在使用的命名空间的dll?是的,我们确实提到了/referene:c:\ program files **中的路径,但是在构建&部署以及在某些用户的计算机上安装软件的时间.它可能与我(开发人员)提到的路径不同.我的意思是可能还有其他地方吗?

How does .NET locate the dll of the namespace I'm using? yeah, we do mention the path in /referene:c:\program files** but after building & deploying and when the software is installed on some user's machine. It may not be at the same path as I (developer) mentioned it would be. I mean it could be some where else right?

  1. 那么,.NET如何找到它?
  2. .NET如何在运行时知道dll中的所有名称空间?
  3. 如果用户具有相同的dll但他重命名了该怎么办?.net会加载失败吗?

推荐答案

如果运行fuslogvw.exe(来自.NET SDK)并启用对磁盘的所有绑定的日志记录,则可以看到正在执行的各种探测步骤.您将能够看到.NET CLR用于解析程序集引用的各种路径.经验法则是先尝试使用全局程序集缓存,然后再检查本地目录以及其他一系列替代路径.

You can see the various probing steps in action if you run fuslogvw.exe (from the .NET SDK) and enable logging of all binds to disk. You will be able to see the various paths that .NET CLR uses to resolve assembly references. The rule of thumb though is to try the Global Assembly Cache first then check the local directory along with a bunch of other alternate paths.

这篇关于.NET如何找到我正在使用的命名空间的dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆