2.0 / 3.5组件并排

时间:2022-10-22 06:06:30

I have a web application that I expect to intergrate features in assemblies from two separate providers. One set (Set1) of assemblies is build on .NET 2.0 while the other set (Set2) of assemblies ABSOLUTELY requires .NET 3.5. For Set2 assemblies to work, I have to add a (system.codedom) section to web.config and specify the v3.5 compiler. However, that seems to break code referencing Set1 assemblies (the JIT compiler takes forever and request times out). When I remove the system.codedom section, some features of the application referencing Set2 fail.

我有一个Web应用程序,我期望从两个独立的提供程序集成程序集中的功能。一组(Set1)程序集构建在.NET 2.0上,而另一组程序集(Set2)绝对需要.NET 3.5。要使Set2程序集正常工作,我必须在web.config中添加(system.codedom)部分并指定v3.5编译器。但是,这似乎打破了引用Set1程序集的代码(JIT编译器永远需要并且请求超时)。当我删除system.codedom部分时,引用Set2的应用程序的某些功能会失败。

We started this project with the knowledge that .NET 2.0 and 3.5 can coexist without any problems. Is there any way of making these two sets of assemblies play nicely?

我们开始这个项目时,知道.NET 2.0和3.5可以毫无问题地共存。有没有办法让这两组装配很好玩?

EDIT: Here is what the system.codedom section looks like;

编辑:这是system.codedom部分的样子;

  <system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="WarnAsError" value="false"/>
  </compiler>
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="OptionInfer" value="true"/>
    <providerOption name="WarnAsError" value="false"/>
  </compiler>
</compilers>

4 个解决方案

#1


If your application domain is initiated in .NET 2.0, only .NET 2.0 assemblies will be able to load. If your application domain is initiated in .NET 3.5, you will be able to load .NET 2.0 and .NET 3.5 assemblies without any problems.

如果您的应用程序域是在.NET 2.0中启动的,则只能加载.NET 2.0程序集。如果您的应用程序域是在.NET 3.5中启动的,那么您将能够毫无问题地加载.NET 2.0和.NET 3.5程序集。

So, let's say for example that you create a Windows Application Project and you set your target to .NET 2.0, you will not be able to load .NET 3.5 assemblies. If you target your project to .NET 3.5, 2.0 assemblies and 3.5 assemblies will load without any problems.

因此,假设您创建一个Windows应用程序项目并将目标设置为.NET 2.0,则无法加载.NET 3.5程序集。如果您将项目定位到.NET 3.5,2.0程序集和3.5程序集将加载没有任何问题。

#2


There is no "3.5 runtime" for .NET web applications (ASP.NET). ASP.NET 3.5 apps run on the 2.0 runtime, and the 3.5 "stuff" is just added libraries that have to be installed on the machine.

.NET Web应用程序(ASP.NET)没有“3.5运行时”。 ASP.NET 3.5应用程序在2.0运行时运行,3.5“东西”只是添加了必须在机器上安装的库。

Are you sure that 3.5 has been installed on the server where this is running?

你确定在运行它的服务器上安装了3.5吗?

Are you recompiling your own web application? Or just changing the config file? What type of project is your app? Web site project? Web application project?

您是否重新编译自己的Web应用程序?或者只是更改配置文件?你的应用是什么类型的项目?网站项目? Web应用程序项目?

#3


The CLR has not changed between 2.0 and 3.5 - the core BCL also hasn't. 3.0 and 3.5 only add new stuff - they should be completely compatible with 2.0.

CLR在2.0和3.5之间没有变化 - 核心BCL也没有。 3.0和3.5只添加新东西 - 它们应该与2.0完全兼容。

See link for more info (red/green bits).

有关详细信息,请参阅链接(红色/绿色位)。

#4


I've had the same thing happening, but that was when running a beta version of .net 3.5 / vs2008. As said before, 3.5 is just an "add-on".

我发生了同样的事情,但那是在运行测试版的.net 3.5 / vs2008时。如前所述,3.5只是一个“附加组件”。

#1


If your application domain is initiated in .NET 2.0, only .NET 2.0 assemblies will be able to load. If your application domain is initiated in .NET 3.5, you will be able to load .NET 2.0 and .NET 3.5 assemblies without any problems.

如果您的应用程序域是在.NET 2.0中启动的,则只能加载.NET 2.0程序集。如果您的应用程序域是在.NET 3.5中启动的,那么您将能够毫无问题地加载.NET 2.0和.NET 3.5程序集。

So, let's say for example that you create a Windows Application Project and you set your target to .NET 2.0, you will not be able to load .NET 3.5 assemblies. If you target your project to .NET 3.5, 2.0 assemblies and 3.5 assemblies will load without any problems.

因此,假设您创建一个Windows应用程序项目并将目标设置为.NET 2.0,则无法加载.NET 3.5程序集。如果您将项目定位到.NET 3.5,2.0程序集和3.5程序集将加载没有任何问题。

#2


There is no "3.5 runtime" for .NET web applications (ASP.NET). ASP.NET 3.5 apps run on the 2.0 runtime, and the 3.5 "stuff" is just added libraries that have to be installed on the machine.

.NET Web应用程序(ASP.NET)没有“3.5运行时”。 ASP.NET 3.5应用程序在2.0运行时运行,3.5“东西”只是添加了必须在机器上安装的库。

Are you sure that 3.5 has been installed on the server where this is running?

你确定在运行它的服务器上安装了3.5吗?

Are you recompiling your own web application? Or just changing the config file? What type of project is your app? Web site project? Web application project?

您是否重新编译自己的Web应用程序?或者只是更改配置文件?你的应用是什么类型的项目?网站项目? Web应用程序项目?

#3


The CLR has not changed between 2.0 and 3.5 - the core BCL also hasn't. 3.0 and 3.5 only add new stuff - they should be completely compatible with 2.0.

CLR在2.0和3.5之间没有变化 - 核心BCL也没有。 3.0和3.5只添加新东西 - 它们应该与2.0完全兼容。

See link for more info (red/green bits).

有关详细信息,请参阅链接(红色/绿色位)。

#4


I've had the same thing happening, but that was when running a beta version of .net 3.5 / vs2008. As said before, 3.5 is just an "add-on".

我发生了同样的事情,但那是在运行测试版的.net 3.5 / vs2008时。如前所述,3.5只是一个“附加组件”。