.NET CLR 2.0 vs CLR 4.0 usage

Posted on 2013-09-30
Medium Priority
Last Modified: 2013-10-01
Curious, if you created an .NET application using the  2.0 net framework, and it used say the dll called System.Data.dll. This dll would be found in the directory
c:\windows\Microsoft .Net\Framework\v2.0.50727\ .
So if you solely change the runtime in your app.config file  to V4.0.30319, would your program load the System.Data.dll found in
c:\windows\Microsoft .Net\Framework\v4.0.30319\ .

Or would it stick to the version  in c:\windows\Microsoft .Net \Framework\v2.0.50727\  ?
And I guess what I am saying is ---is the CLR looking for the exact strong name of the dll that was used when the application was built?
Question by:metro156
  • 2
  • 2
LVL 19

Expert Comment

by:Melih SARICA
ID: 39534118
Yes IF ur not using particular dll that is copied to bin directory(3rd party dll's) when u change the configuraion of ur project from .net2.0 .net4.0 all dll's using the framework assemblies ll be changed to target framework

Author Comment

ID: 39534289
When I mean change my configuration, I mean in the app.config file not the properties window in Visual Studio.  But the app.config file like so:
<?xml version="1.0" encoding="utf-8"?>
     <supportedRuntime version="v4.0.30319"/>

So it ignores the strong name of the dll????

Author Comment

ID: 39534437
I found by changing the runtime in the app.config does change what version of .NET Library you are using.
See the attached file. You can take the code and plug it in to a c# console application project and add the app.config to it. By changing the version of the runtime in the app.config , it will change the version of the dlls used. However, I haven't tested the situation where say the possibility of the dll in the later version of the runtime might be archived and removed. I am not sure what happens there. Maybe you can use a codebase in your app.config for a particular module if it is only in the older version of the .NET Framework. I am not sure yet. Need to test that situation.
LVL 19

Accepted Solution

Melih SARICA earned 2000 total points
ID: 39536028
Thats what im saying on my comment.
.NET CLR did not import assemblies in the GAC or bin folder. It only reference these dll's with Framework and name .. so in what version u target in ur config that version ll run

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you are looking for an automated tool which can generate reports for Outlook emails and other items from PST file, then you can go for Kernel PST Reporter tool. The reports which are created by this tool are helpful to analyze and understand PST …
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question