Multiple versions of .NET on the same server

CJ Alpha picture CJ Alpha · Mar 8, 2018 · Viewed 8.7k times · Source

So I've always known it's okay to run multiple versions of the .NET framework on a single computer (client or server alike). This question, though a bit old, talks about this.

A while back, however, I was tasked with creating a new ASP.NET application, and I was trying to decide whether to use the full .NET framework or .NET Core, and I came across this article from Microsoft. The article states that if I need side-by-side installations of the framework, I should use .NET Core. Here's the full quote:

To install applications with dependencies on different versions of .NET, we recommend .NET Core. .NET Core offers side-by-side installation of different versions of the .NET Core runtime on the same machine. This side-by-side installation allows multiple services on the same server, each of them on its own version of .NET Core.

But I thought side-by-side installations of the Framework were already possible without .NET Core? What am I missing?

The reason I ask is that I currently have an old ASP.NET application that uses the .NET Framework 2.0, and I am now working on one that uses .NET Core. I ran into some issues that got me considering switching the .NET Core app to the full .NET Framework 4.6, but that Microsoft article got me a bit confused.

The question is: will I be able to run both apps (.NET framework 2.0 and 4.6) on the same Windows 2008 R2 server without issues? If so, then what is that article referring to?

One last thing: both my apps (old and new) use Crystal Reports. There's a possibility that the new app might need a newer version of Crystal Reports than the old app. Will I be able to run different versions of Crystal Reports like this on the same server? Is this the situation in which I would require .NET Core like the Microsoft article says?

Thank you

Answer

Jeroen Mostert picture Jeroen Mostert · Mar 9, 2018

Side-by-side installations of the framework are not only possible, they are a fact. NET 1.0, 2.0 and everything past 4.0 all have separate installations. However:

  • .NET 3.0 and 3.5 both use the 2.0 runtime and are therefore not truly separate.
  • Similarly, .NET 4.5 and all versions above all use the 4.0 runtime and are therefore not separate from each other. To further complicate things, when you install a later version, the base 4.0 runtime is actually upgraded.
  • Last but not least, which framework version gets picked to run your application has changed with .NET 4.0. The rules for this are rather complicated and depend on both the versions installed and the application configuration; see this article for a full discussion.

To your question, then:

Will I be able to run both apps (.NET framework 2.0 and 4.6) on the same Windows 2008 R2 server without issues?

If .NET Framework 2.0 and 4.6 are both installed, then yes. Assuming no special configuration settings, the 2.0 application will run on the 2.0 framework, but it can also be configured to use the 4.6 framework (which will present itself as the 4.0 runtime).

If so, then what is that article referring to?

The article is referring to the fact that the full .NET Framework has gradually abandoned the idea of perfectly separate side-by-side installations by having no separations between minor version (and sometimes even major versions), while .NET Core has doubled down on the idea by allowing self-contained deployment. That is to say, not only can a .NET Core 1.0 and a .NET Core 2.0 application coexist without any risk of sharing dependencies the way a .NET Framework 2.0 and 3.5 application would, even two .NET Core 1.0 applications can exist together without sharing dependencies, something which is not possible for full .NET Framework applications. If (say) a patch is installed for .NET 2.0, it will affect all .NET 2.0, 3.0 and 3.5 applications, at least on the binary level. You cannot choose to have some applications affected by the patch and not others (although configuration switches are usually added for behavior that breaks compatibility).

One last thing: both my apps (old and new) use Crystal Reports. There's a possibility that the new app might need a newer version of Crystal Reports than the old app. Will I be able to run different versions of Crystal Reports like this on the same server? Is this the situation in which I would require .NET Core like the Microsoft article says?

This is independent of the framework and depends on how Crystal Reports itself handles versioning. According to the manufacturer, the answer is yes, for major releases but not minor updates:

Side-by-side installation of different major release version of Crystal Reports designer is supported since Crystal Reports 9, because each major release version installs the software in different directory.

You do not require .NET Core to make side-by-side installation of different assembly versions possible. What's more, even if you used a self-contained deployment of your .NET Core application, it would likely still refer to the shared installation of Crystal Reports on the machine, not to a self-contained deployment of Crystal Reports (I don't think such a thing exists; I'm not even sure Crystal Reports is currently supported on .NET Core).

Last but not least: note that some versions of .NET are no longer officially supported. The policies on what versions are supported (and where) are fairy complex, depending as they do on whether the Framework was part of the OS or not, but detailed here. .NET 4.6 has some very nasty JIT compiler bugs (fixed in 4.6.1), so you really don't want to be using it anyway, official support or no. If your server does not yet have any version of .NET past 2.0 installed, you may as well jump directly to the latest supported version for your OS (as of writing, 4.8).