简体   繁体   English

在.NET 1.1中调用.NET 2.0程序集

[英]Calling .NET 2.0 assemblies in .NET 1.1

Recently I developed a internal framework in .NET 2.0 version, which is basically classes and helpers. 最近我开发了.NET 2.0版本的内部框架,基本上是类和帮助器。

The problem is I have some .NET 1.1 sites and applications and would like to use my framework from them. 问题是我有一些.NET 1.1站点和应用程序,并希望使用我的框架。 I know that I can't call .NET 2.0 in .NET 1.1, but I have an idea. 我知道我不能在.NET 1.1中调用.NET 2.0,但我有一个想法。

If I create another 2.0 project with ComVisible and reference some of my 2.0 assemblies, then recreate my needed functions only referencing these classes, and in .NET 1.1 call this new ComVisible assembly; 如果我使用ComVisible创建另一个2.0项目并引用我的一些2.0程序集,那么只重新引用我需要的函数,引用这些类,并在.NET 1.1中调用这个新的ComVisible程序集; could I then use 2.0 assemblies in .NET 1.1? 我可以在.NET 1.1中使用2.0程序集吗?

If this works basically I can use it in .NET 1.1, Java Reflection, etc. 如果这基本上可以工作,我可以在.NET 1.1,Java Reflection等中使用它。

Or am I wasting my time? 还是我在浪费时间?

I don't see why you'd want to go through all of this effort. 我不明白为什么你想要完成所有这些努力。 There are only two possibilities - either: 只有两种可能性 - 或者:

  1. The servers/workstations running those sites/applications have the .NET Framework 2.0 installed, in which case you might as well just re-target those sites/applications to .NET 2.0 and rebuild/redeploy them (which should take all of 10 minutes), or 运行这些站点/应用程序的服务器/工作站安装了.NET Framework 2.0,在这种情况下,您可能只需将这些站点/应用程序重新定位到.NET 2.0并重建/重新部署它们(这应该需要10分钟) , 要么

  2. The servers/workstations do not have the .NET Framework 2.0 installed, in which case all your COM effort is for naught because the 2.0 assemblies themselves won't be able to run without the Framework. 服务器/工作站没有安装.NET Framework 2.0,在这种情况下,您的所有COM工作都是徒劳的,因为2.0程序集本身无法在没有Framework的情况下运行。

I recently re-targeted a whole bunch of "legacy" 2.0 apps to 3.5 as in #1 without a single problem. 我最近将一大堆“遗留”2.0应用程序重新定位到3.5,就像#1一样没有任何问题。 I know that there were a tiny handful of breaking changes from 1.1 to 2.0, but they are so few in number that it would almost certainly take less time to search for those than it would take to deal with all that COM craziness. 我知道从1.1到2.0有一小部分突破性的变化,但它们数量如此之少,以至于它几乎肯定会花费更少的时间来搜索那些比处理所有COM疯狂所需的时间。

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

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