11

Having gone through various blogs, I am quite confused about the terminology of "multitargeting" or side by side execution.

  1. Some blogs say that, side by side execution means two versions of CLRs in a process. Some others claims that, its like .net 2.0 and .net 3.0 assembly executing side by side. I am extremely disappointed that I am unsure who is right who is wrong.

  2. I also saw in many blogs like Scott Hanselman's blog etc (Which confuses a lot), that, any feature of .NET 4.5 will not work if the target framework is 4.0. I can agree to it. But I cannot agree or understand the fact that, a feature of 4.0 whose bug is fixed in 4.5, will go hidden if I build it using 4.5 and deploy in 4.0. Here I don't understand the term "hidden" and nobody dare to explain what actually it means. It means runtime error ? It means compile time error? It cant be this. It means inconsistent behavior ? Exception ? If this is the case, I wonder why MS has let this type of flexibility in development in VS. Does it serves ANY purpose ? I understand that, the first case is meaningful, but dont understand or agree with second case.

  3. I also saw in Rick/Scott Hanselman's post that, Major changes means, complete upgrade including CLR. Then, I should see 3.0 as major upgrade but its not as it still uses .NET 2.0 CLR. Then why the naming terminology is 3.0.x.x/3.5.x.x ? Like the case in .NET 4.0.30319.x where CLR is also new, so I agree with this. I am surprised who is correct. Either these folks or MSDN as both contradicts their principles (Like MSDN says the formatting as Major.Minor.Build.Revision, and Hanselman or others say, Major means CLR upgrade and while it is not in .NET 3.0)

Ref: http://www.hanselman.com/blog/NETVersioningAndMultiTargetingNET45IsAnInplaceUpgradeToNET40.aspx

http://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx

Any thoughts on above two questions?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Jasmine
  • 5,186
  • 16
  • 62
  • 114

4 Answers4

2

First of all you have to understand difference between the Multitargetting and Side-by-side execution.

  • Multitargettting is the ability you to compile applications which would be run on the CLR runtime which different from that you are using for the developing the application (.NET 4.0 in case of VS2010 or .NET 4.5 in case of VS 2012). Multitargetting in the VS ensures that your application would not use any types or methods which was introduced in the CLR runtime and Base Class Library (BCL) in the versions which are newer then the version which you are targetted. VS doing so by having copy of the DLL's which are used in the each runtime which could be targetted.
  • Side-by-side execution means that you could have more then one version of CLR runtime installed on you PC. As of CLR 4.0 is no longer correct. You now able to load CLR 4 inside same process together with older runtimes (CLR 1.1 or CLR 2.0). Please read http://msdn.microsoft.com/en-us/magazine/ee819091.aspx (Section "Overview of Behavior") for more details.

Regarding your questions:

  1. Please read link from the MSDN article mentioned above.
  2. Term hidden means that when you will debug application under .NET 4.5 you have versions of BCL with bugfixes which potentially hit you in the back after you deploy to .NET 4.0 since that bug was not fixed yet on that version of BCL. You will have runtime error which you could observe in the way which would depends on the type of bug which you reaching. That could be security issue, logical error in your application or runtime exception. If you want to catch these issues you could always test on the clean PC which has only .NET 4.0 installed.
  3. Both links that you give does not interfer with each other in any way. Scott and MSDN both are correct in the explanation what version of .NET has which version of CLR runtime has installed.
codevision
  • 5,165
  • 38
  • 50
  • Hi codevision, thank you so much for answering me :) Its helpful. Lets also invite others to chime in with their views :) Cheers – Jasmine Mar 22 '13 at 20:19
0

Here's what I think.

.NET has evolved through multiple versions and multiple runtimes. A new version of .NET may or may not have a new runtime.

.NET 1.0 shipped with a runtime. .NET 1.1 was a bunch of fixes and additions to the existing system. It's an incremental upgrade.

So, anything which targeted 1.0, will seamlessly run on 1.1, given that you don't rely on those fixed bugs .etc.

.NET 2.0 is a new versions with a brand new runtime. Now your PC can have both 1.1 and 2.0 installed side by side.. and 1.1 apps will use .NET 1.1 runtime, and 2.0 targeting apps will use 2.0 runtime..

Things get a bit complicated with 3.0 and 3.5 releases. They may contain some fixes (i think) but mainly, they add a bunch of classes to the libraries, and still use the same 2.0 runtime.

Now 3.5 targeting apps will still use .NET 2.0 runtime, and will work. They don't know about the new classes added in 3.5 (ex: LINQ) and they don't have to.

.NET 4.0 again, is a brand new runtime. It can be installed side-by-side with 2.0 and 3.5. And apps targeting .NET 2.0 will still require and run on .NET 2.0 runtime, while new apps compiled for NET 4.0 will use the new runtime. There are some changes introduced to how assemblies are located and loaded to the runtime in .NET 4.0, so if you simply compile your 2.0 app to work with 4.0, it may have some hitches. But it will work once you fix these issues (if any)

Now.. .NET 4.5 is again a slightly different story. It's a new runtime (AFAIK) but it is replacing the one is 4.0. You can't have 4.0 and 4.5 running side-by-side. Now 4.0 targeting apps will run on the 4.5 runtime... which got some fixes applied. So if your app relies on those bugs available in 4.0, it will have issues on 4.5.

This is a quick and dirty answer. If you see any issues/mismatches/possible improvements, please feel free to edit.

HTH

Madushan
  • 6,977
  • 31
  • 79
0
  1. Side-by-side execution means multiple CLRs in one process. .NET2 alongside .NET3.5 is not side by side as the CLR is the same. .NET2 and .NET4, however, is.
  2. What do you mean "build in .NET4.5 and deploy in .NET4.0"?
  3. You ask for a clear cut technical distinction of something that is decided by Microsoft marketing.
Tormod
  • 4,551
  • 2
  • 28
  • 50
  • Tormod, what is mean by DLL Hell problem resolution ? Executing assesmblies side by side ? And I can target a 3.5 or 3.0 or 2.0 Framework assembly. Assembly version is the solution to Dell Hell ? Why is all these terminologies not clear ? I am curious what exactly it is to mean by side by side execution whether CLR as you said, or assemblies as said in many blogs and even in MSDN. – Jasmine Mar 22 '13 at 12:00
  • Multi-targeting just means compiling for a specific version. Side by side like Tormod said actually means the runtime is capable of loading multiple versions of .NET into memory and executing them together (think: mixing 2.0 dlls with 4.5 dlls) – Robert Hoffmann Apr 07 '13 at 01:21
0

Some blogs say that, side by side execution means two versions of CLRs in a process. Some others claims that, its like .net 2.0 and .net 3.0 assembly executing side by side. I am extremely disappointed that I am unsure who is right who is wrong.

The "some others" are simply misleading themselves. .NET Framework 2.0 and 3.0 assemblies are not executed "side by side". Like so many others said, side by side execution is only meaningful if you run a mixture of CLR 1.x/2.0/4.0.

MS has let this type of flexibility in development in VS. Does it serves ANY purpose ?

It would be beneficial if Windows/.NET reports whatever incompatibilities if you run .NET Framework 4.5 apps on raw .NET Framework 4.0. However, that would be too much an effort to achieve, as patching widely released .NET Framework 4.0 is almost impossible.

In such cases Microsoft expects the developers themselves to be smart. When they observe incompatibility (whether it is runtime exception/compile time error or anything else), they should check what is the cause and resolve that.

Then why the naming terminology is 3.0.x.x/3.5.x.x ?

That's just part of the history, and asking why is pointless. Microsoft learns from those mistakes, and .NET Core is on the right track.

Lex Li
  • 60,503
  • 9
  • 116
  • 147