2

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?

Kara
  • 6,115
  • 16
  • 50
  • 57
Dzmitry Lahoda
  • 939
  • 1
  • 13
  • 34
  • 4
    I don't get it. If the customer does not have .NET4, how do you expect to load the .NET4 runtime at all? – R. Martinho Fernandes Apr 21 '11 at 14:02
  • If customer does not want to use NET4APP, we should not make him to install .NET 4.0. But customer who uses NET4APP should be provided with integrated/unified experience with .NET 3.5 apps. – Dzmitry Lahoda Apr 21 '11 at 16:18

4 Answers4

4

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 :)

Dmitrii Lobanov
  • 4,897
  • 1
  • 33
  • 50
3

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.

Nik
  • 7,113
  • 13
  • 51
  • 80
2

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.

R. Martinho Fernandes
  • 228,013
  • 71
  • 433
  • 510
  • It seems that we wrote C++ loader which loads CLR 4 or 2 during start. Our .NET 3.5 add-ins run under CLR 4.0 when it exists. Add-in which requires CLR 4.0 is not loaded when there is only CLR 2. – Dzmitry Lahoda May 05 '11 at 20:12
1

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.

Jamie Keeling
  • 9,806
  • 17
  • 65
  • 102