Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoiding .NET versioning hell

So sometimes (oftentimes!) you want to target a specific .NET version (say 3.0), but then due to some .NET service packs you get into problems like:

  • Dispatcher.BeginInvoke(Delegate, Object[]) <-- this was added in 3.0 SP2 (3.0.30618 )
  • System.Threading.WaitHandle.WaitOne(Int32) <-- this was added in 3.5 SP1, 3.0 SP2, 2.0 SP2

Now, these are detected by the JIT compiler, so building against .NET 3.0 in Visual Studio won't guarante it will run on .NET 3.0 only systems.

Short of

  • confirming each and every function you use, or
  • limiting your development environment to .NET 3.0 (which sucks since you have to develop for other projects too)

what's the best way to avoid against using extensions?

Thanks!

like image 475
moogs Avatar asked Mar 11 '10 11:03

moogs


People also ask

How do you resolve DLL Hell?

A simple solution to DLL Hell in an application is to statically link all the libraries, i.e. to include the library version required in the program, instead of picking up a system library with a specified name. This is common in C/C++ applications, where, instead of having to worry about which version of MFC42.

What is DLL Hell and how does .NET solve it?

DLL hell is a common term for various problems associated with the use of dynamic link libraries (DLLs) or DLL files. A DLL file is a resource within the Windows operating system that contains code and data related to the functionality of one or more applications. These files, which may have the file extension .

Does version of .NET matter?

Net versions adds up certain new features or functionality. Any way its better to understand latest . Net version which will help you in projects.

How does assembly versioning in .NET prevent DLL Hell?

NET prevent DLL Hell? - The runtime checks to see that only one version of an assembly is on the machine at any one time. - NET allows assemblies to specify the name AND the version of any assemblies they need to run.


2 Answers

Microsoft tend to assume that, if you have .NET XXX installed, then you must be on the latest service pack because Windows Update will push them out to you as critical updates. I know it's a brittle assumption and sometimes breaks down, but that's what's supposed to happen.

Our products currently target .NET 3.5 SP1, and as such we would be astonished to find a target environment still running .NET 3.5 RTM.

like image 179
Christian Hayter Avatar answered Sep 23 '22 16:09

Christian Hayter


This capability is built into Visual Studio as of VS 2008 SP1 and is also available in FxCop 1.36. Take a look at David Kean's blog post for more details.

alt text http://davesbox.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/blog/ErrorList_5F00_3.png

like image 30
Jerry Bullard Avatar answered Sep 20 '22 16:09

Jerry Bullard