确定 .NET 程序集框架依赖项的工具

发布于 2024-09-09 04:08:51 字数 440 浏览 0 评论 0原文

我正在寻找一种工具,可以告诉我 .NET 程序集将在哪些框架下工作。或者更具体地说,BCL(基类库)版本中的方法需要什么。

触发我的是这样的: 今天,我收到了一份针对我们正在制作的应用程序的错误报告,基本上是这样说的:“您正在使用 WaitOne(Int32),但这只适用于 .NET 3.5 SP1,不适用于普通 3.5;请改用 WaitOne(Int32,Boolean)” 。确实,用户是对的。 WaitOne 在 .NET 中永远存在,但在 1.0、2.0 等的服务包中引入了仅需要 int 的特定重载。因此,我们的应用程序在例如普通的 3.5 框架安装中会失败。坦率地说,我们还没有对此进行测试。

因此,我不是在安装了各种框架的机器上测试/加载应用程序,这不是很容易,而是在寻找一种工具,它可以简单地告诉我给定程序集中的方法将在哪些正式发布的框架版本下工作 -或者,更有趣的是,它不能在哪些版本下工作以及有问题的方法是什么。

I'm looking for a tool that can tell me what frameworks a .NET assembly will work under. Or more specifically, what BCL (base class libraries) versions the methods within it requires.

What triggered me was this:
Today I got a bug-report against an application we're making that basically said: "you're using WaitOne(Int32) but that only works for .NET 3.5 SP1, not plain 3.5; use WaitOne(Int32,Boolean) instead". And indeed the user was right. WaitOne has existed forever in .NET but the particular overload that takes only an int was introduced in service packs for 1.0, 2.0 etc. Therefore, our app would fail on e.g. a plain 3.5 framework installation. And frankly we hadn't tested for that.

Instead of testing/loading the app on machines with all kinds of frameworks installed, which is not very easy, I'm therefore looking for a tool that can simply tell me what officially released framework versions the methods in a given assembly will work under - or, more interestingly, what versions it will not work under and what the offending methods are.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简美 2024-09-16 04:08:51

我个人不知道有什么工具可以分析 .NET 程序集并告诉您哪些方法对于特定框架版本可用/不可用。

我认为您能做的最好的事情就是在框架的各种配置下运行代码。例如,您可以尝试使用 VMWareHyper-V 创建安装了不同版本的 .NET 框架的虚拟机。可能值得一试。

除此之外,您必须手动查看 .NET 代码并手动检查它,与 MSDN 交叉引用代码以确定某个方法对于特定框架版本是否有效。

我对其他人的答案感兴趣 - 如果有一个工具可以分析 .NET 代码以确定不同版本的有效性,那么这就是一个杀手级应用程序! :)

I don't personally know of any tool which can analyse a .NET assembly and tell you which methods are available/unavailable to a specific framework version.

I think the best you can do is run the code under various configurations of the framework. For example, you could try using VMWare or Hyper-V to create virtual machines which have different versions of the .NET framework installed. Might be worth a shot.

Other then that, you will have to manually look at your .NET code and review it by hand, cross referencing the code with MSDN to work out whether a method if valid for a specific framework version.

I'd be interested in other people's answers - if there is a tool that can analyse .NET code to determine validity on different versions, then that's a killer app! :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文