简体   繁体   English

从.NET 3.5应用程序运行.NET 4.0应用程序

[英]Running .NET 4.0 application from .NET 3.5 application

We have 2 desktop host apps written on .NET 3.5 and .NET 4.0. 我们有两个在.NET 3.5和.NET 4.0上编写的桌面主机应用程序。 We have 3 add-ins written on .NET 3.5. 我们在.NET 3.5上编写了3个加载项。 One add-in is written on .NET 4 - "NET4APP". 一个加载项是在.NET 4上编写的 - “NET4APP”。

We want to integrate host apps and add-ins using .NET 3.5 host app for all add-ins. 我们希望使用.NET 3.5主机应用程序为所有加载项集成主机应用程序和加载项。

They can be bundled in any combination with MSI package. 它们可以与MSI包的任意组合捆绑在一起。

We do not want to make customer to use .NET 4 if they do not have it and do not use NET4APP. 我们不希望让客户使用.NET 4,如果他们没有它并且不使用NET4APP。

Is there any way to load .NET 4 app (or .NET 4 runtime) into .NET 3.5 app? 有没有办法将.NET 4应用程序(或.NET 4运行时)加载到.NET 3.5应用程序中?

It is not possible to run .net 4.0 application under .net 3.5 runtime (actually .net 2.0 runtime). 在.net 3.5运行时(实际上是.net 2.0运行时)下运行.net 4.0应用程序是不可能的。 If it would be .net 3.5 application, you can run it under 2.0 runtime, because .net 3.5 applications are running under .net 2.0 runtime. 如果它是.net 3.5应用程序,则可以在2.0运行时运行它,因为.net 3.5应用程序在.net 2.0运行时下运行。 But there would be problems, this way is dangerous. 但是会有问题,这种方式很危险。 And if you want to run .net 4.0 application you have to use .net 4.0 runtime, there's no choice. 如果你想运行.net 4.0应用程序,你必须使用.net 4.0运行时,别无选择。 Or you have to rewrite it to .net 3.5. 或者你必须将其重写为.net 3.5。

We had to rewrite some part of our project from .net 3.5 to .net 2.0 RTM, because some of our clients don't have .net 3.5 installed, some of them event don't have 2.0 SP1 installed, so we rewrote our product to be .net 2.0 RTM compliant. 我们不得不将.net 3.5的某些部分重写为.net 2.0 RTM,因为我们的一些客户没有安装.net 3.5,其中一些事件没有安装2.0 SP1,所以我们改写了我们的产品符合.net 2.0 RTM标准。 We still use some features of .net 3.5 distributing some of .net 3.5 assemblies with our product. 我们仍然使用.net 3.5的一些功能,将一些.net 3.5程序集与我们的产品一起分发。 Actually it wasn't a problem since we still can use extension methods, lambdas, linq-to-objects. 实际上这不是问题,因为我们仍然可以使用扩展方法,lambdas,linq-to-objects。 And I'm sure there won't be any problem for you to step back to .net 3.5 runtime. 我相信你回到.net 3.5运行时没有任何问题。 Stepping back from .net 3.5 to .net 2.0 is much more painful :) 从.net 3.5退回到.net 2.0会更加痛苦:)

No; 没有; however, you should compile your .NET 4.0 app in .NET 3.5 and see what happens. 但是,您应该在.NET 3.5中编译.NET 4.0应用程序,看看会发生什么。 It's possible you're not using anything specific to 4.0 and can just compile it into 3.5. 您可能没有使用4.0特定的任何内容,只能将其编译为3.5。

The customers with .NET4, you can simply run the whole thing under .NET4. 使用.NET4的客户,您可以简单地在.NET4下运行整个事物。 If you provide two setups (one with NET4APP, and one without) everyone will be happy. 如果你提供两个设置(一个使用NET4APP,一个没有),每个人都会很高兴。

You can't load the .Net 4 runtime if the customer (or machine) does not have an installation of it, have you tried building your .Net 4 application under .Net 3.5? 如果客户(或机器)没有安装它,您是否无法加载.Net 4运行时,您是否尝试在.Net 3.5下构建.Net 4应用程序? There's a chance that you're not using components that are specific to .Net 4. 您可能没有使用特定于.Net 4的组件。

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

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