简体   繁体   中英

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. We have 3 add-ins written on .NET 3.5. One add-in is written on .NET 4 - "NET4APP".

We want to integrate host apps and add-ins using .NET 3.5 host app for all add-ins.

They can be bundled in any combination with MSI package.

We do not want to make customer to use .NET 4 if they do not have it and do not use NET4APP.

Is there any way to load .NET 4 app (or .NET 4 runtime) into .NET 3.5 app?

It is not possible to run .net 4.0 application under .net 3.5 runtime (actually .net 2.0 runtime). 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. 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. Or you have to rewrite it to .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. We still use some features of .net 3.5 distributing some of .net 3.5 assemblies with our product. Actually it wasn't a problem since we still can use extension methods, lambdas, linq-to-objects. And I'm sure there won't be any problem for you to step back to .net 3.5 runtime. Stepping back from .net 3.5 to .net 2.0 is much more painful :)

No; however, you should compile your .NET 4.0 app in .NET 3.5 and see what happens. It's possible you're not using anything specific to 4.0 and can just compile it into 3.5.

The customers with .NET4, you can simply run the whole thing under .NET4. If you provide two setups (one with NET4APP, and one without) everyone will be happy.

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? There's a chance that you're not using components that are specific to .Net 4.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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