.NET Frameworks Question 2.0, 3.5 and 4.0 when only targeting 4.0 ?

daveaton

New member
Joined
Oct 11, 2011
Messages
3
Programming Experience
3-5
If I have an app that was targeting 4.x framework but used controls that used 3.5 and 2.0 in this same app. Would the user have to have the 3.5 and the 2.0 frameworks installed?

I want to install my app on windows 2003 with only framework 1.1 pre-installed. I made a installer that installs 4.0 framework. Do I need to make my installer install frameworks 2.0 and 3.5 along with 4.0 ?

Thanks in advance.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
You will need to have your installer check for (and install) all of the needed Frameworks for your application to work. Luckily for you if you have something that targets the 3.5 Framework then you only need to check for the 3.5 Framework even if you also have something depending on the 2.0 Framework. Reason for that is because the 3.5 Framework requires the 3.0 Framework be installed and the 3.0 Framework requires the 2.0 Framework, so just to have the 3.5 FW installed you have to have the other 2 installed as well, which simplifies it for you.
 

daveaton

New member
Joined
Oct 11, 2011
Messages
3
Programming Experience
3-5
How about for the framework 4.0 ?

So are you saying that if I targeted the 4.0 frame work I would just need to make sure the 4.0 and 3.5 framework are installed ?

Thanks in advance.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
No, I'm saying that if everything in your app targets just the 4.0 Framework then all you need is the 4.0 Framework as a requirement in the installer. But if your 4.0 FW app uses a dll that targets the 3.5 FW then your installer will need to check for both the 4.0 FW and the 3.5 FW. But if your 4.0 FW app uses a dll that targets the 3.5 FW and another dll that targets the 2.0 FW then all you need your installer to check for is the 4.0 and 3.5 Frameworks, because the 3.5 Framework installer will install the 3.0 Framework and the 3.0 Framework installer will install the 2.0 Framework as needed for you.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,377
Location
Norway
Programming Experience
10+
According to this Version Compatibility in the .NET Framework previous .Net version assemblies should work on the .Net 4 runtime.

Also realize that only one CLR version runs for a given process (application), so when app is compiled for .Net 4 it runs on CLR 4, and all referenced assemblies are also loaded by same CLR 4.

One more note, referenced assemblies is not covered by the new In-Process Side-by-Side feature of CLR 4 (ref CLR Inside Out: In-Process Side-by-Side).

daveaton said:
If I have an app that was targeting 4.x framework but used controls that used 3.5 and 2.0 in this same app. Would the user have to have the 3.5 and the 2.0 frameworks installed?
So the answer is no, you only need .Net 4. But do test that everything works reliably, and if possible rebuild dependencies for the apps current .Net version.
 

riham

New member
Joined
Dec 4, 2014
Messages
1
Programming Experience
3-5
That's exactly what happens to me now with the reference 'System.XML.Linq' I need that reference in Framework 2.0, the reason why I need this is just because when my application can't handle an exception automatically trigger an event to send an email with the error's detail but to compose that email I need XML so what can I do?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,377
Location
Norway
Programming Experience
10+
That's exactly what happens to me now with the reference 'System.XML.Linq' I need that reference in Framework 2.0, the reason why I need this is just because when my application can't handle an exception automatically trigger an event to send an email with the error's detail but to compose that email I need XML so what can I do?
Linq was new in .Net 3.5, you can't reference that from a .Net 2 assembly. Start a new thread if you need help with send/compose email.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,251
Location
Sydney, Australia
Programming Experience
10+
That's exactly what happens to me now with the reference 'System.XML.Linq' I need that reference in Framework 2.0, the reason why I need this is just because when my application can't handle an exception automatically trigger an event to send an email with the error's detail but to compose that email I need XML so what can I do?
If you need XML then use XML. You don't need LINQ for that.
 
Top Bottom