2.0/3.5 并排组件
我有一个 Web 应用程序,希望将来自两个不同提供商的程序集中的功能集成起来。 一组 (Set1) 程序集基于 .NET 2.0 构建,而另一组 (Set2) 程序集绝对需要 .NET 3.5。 为了使 Set2 程序集正常工作,我必须向 web.config 添加 (system.codedom) 部分并指定 v3.5 编译器。 然而,这似乎破坏了引用 Set1 程序集的代码(JIT 编译器永远花费时间并且请求超时)。 当我删除 system.codedom 部分时,引用 Set2 的应用程序的某些功能会失败。
我们开始这个项目时就知道 .NET 2.0 和 3.5 可以毫无问题地共存。 有什么办法可以让这两组组件很好地发挥作用吗?
编辑:这是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>
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.
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?
EDIT: Here is what the system.codedom section looks like;
<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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您的应用程序域是在 .NET 2.0 中启动的,则只能加载 .NET 2.0 程序集。 如果您的应用程序域是在 .NET 3.5 中启动的,您将能够毫无问题地加载 .NET 2.0 和 .NET 3.5 程序集。
因此,假设您创建一个 Windows 应用程序项目并将目标设置为 .NET 2.0,您将无法加载 .NET 3.5 程序集。 如果您将项目定位到 .NET 3.5,则 2.0 程序集和 3.5 程序集将毫无问题地加载。
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.
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.
.NET Web 应用程序 (ASP.NET) 没有“3.5 运行时”。 ASP.NET 3.5 应用程序在 2.0 运行时上运行,而 3.5“东西”只是添加了必须安装在计算机上的库。
您确定运行该程序的服务器上已安装 3.5 吗?
您正在重新编译自己的 Web 应用程序吗? 或者只是改变配置文件? 您的应用程序是什么类型的项目? 网站项目? 网络应用项目?
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.
Are you sure that 3.5 has been installed on the server where this is running?
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?
CLR 在 2.0 和 3.5 之间没有变化 - 核心 BCL 也没有变化。 3.0 和 3.5 仅添加了新内容 - 它们应该与 2.0 完全兼容。
查看链接了解更多信息(红色/绿色位)。
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.
See link for more info (red/green bits).
我也发生过同样的事情,但那是在运行 .net 3.5 / vs2008 的测试版时。 如前所述,3.5 只是一个“附加组件”。
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".