.NET 2.0 or 3.5? - c#

Our clients use a vb6 version of our software.
We are upgrading them to a .NET application written in C#...
Is there less bulk using .net 2.0 than .net 3.5?
My definition of less bulk would be: Smaller size, smaller installation time, etc.
Most of them probably already have 2.0 anyway.
I only ask because I would like to take advantage of LINQ in 3.5.

For taking advantage of LINQ, you need 3.5 (unless you want to use LINQBridge with 2.0).
For a smaller installer, .Net 3.5 Sp1 has a new feature called "Client Profile".
The .NET Framework Client Profile setup contains just those assemblies and files in the .NET Framework that are typically used for client application scenarios. For example: it includes Windows Forms, WPF, and WCF. It does not include ASP.NET and those libraries and components used primarily for server scenarios. We expect this setup package to be about 26MB in size, and it can be downloaded and installed much quicker than the full .NET Framework setup package.

Is not installing .NET 3.5 just to save a few Mb really that much more important that gaining a huge increase in productivity with LINQ and other .NET 3.5 features?
Why start off behind in technology?

The .Net 3.5 runtime is ~50Mb. The 2.0 runtime is ~23Mb.
But if you control the deployment or installation, that really shouldn't be an issue. This is especially true for 'clients' vs 'customers', and the word client involves and on-going, personal relationship. If it comes to it, send them a CD. Then anything under 700Mb is all the same.

Check out LINQBridge:
http://www.albahari.com/nutshell/linqbridge.aspx
Adding LINQ support to .net 2 (.net 3.5 still uses CLR 2.0).

.NET 3.5 is .NET 2.0 + more libraries and extensions, so yes, the install is bigger. In my opinion however, it is very much worth the extra bulk because of the extra stuff it gives you.

If it's a VB6 app, you should check which Windows versions the app is currently used on, and select the .Net version accordingly. AFAIK 3.5 does not run on W2K.

If you would like to take advantage of LINQ, then go for 3.5! I find there's not more 'bulk' when using it myself, but unless you want to use LINQ, then either is fine.

Keep in mind that certain OSes (Windows 2000 Server) won't let you install .NET 3.0 or 3.5, so you may have to stick with 2.0 for that reason.

I would suggest that you go straight with visual studio 2008 and .net 3.5 sp1,
2.0 is the basis of 3.5 and you can easily start using 2.0 and then start to use 3.5 functionalities.
Furthermore 3.5 SP1 also brings tweaks to the 2.0 framework which are nice to have.

I suggest you to go directly to 3.5 because you will be less far away (in the future ... in 3-5 years) to change to other version of framework. If in 5 year .Net is at version 5, the jump will be smaller to do. So, VB6 to 3.5 is what I suggest you.
The size of the framework is not very high, less than 60 megs... not a big deal now I think.

Also note, depending were you install the .NET framework it might be irrelevant how much extra bulk there is. The .NET Framework installs are relatively small in modern terms.
As for LINQ, it will save you a lot of time and effort, and offers a quick way to get at data. However it also depends on the clients the application will be distributed out to.
I'd say at that, go with 3.5 unless there is another major roadblock on the clients for whatever reason.

As others have pointed out, the .NET 3.5 install is longer and larger than .NET 2.0. Keep in mind that .NET 3.0 and .NET 3.5 are both extensions on top of the .NET 2.0 CLR.
I would still say upgrade from VB6 directly to .NET 3.5 (actually .NET 3.5 SP1) and VS2008, as long as your client operating systems support that version of the Framework (otherwise you will need to choose the lowest common Framework version, which very well may be .NET 2.0). You will save yourself a lot of time/effort in the long run.

Related

potential problems with c# with windows 7 due to .net versions

I have written an application that uses await async
works very nice
i have been asked to install it on a windows 7 machine and
i am afraid it won't work due to .net issues
if the .net is 3.5 what are the recommended ways of action?
There is no way to use async/await in .NET 3.5. You have a few options:
Convince them to let you install at least .NET 4.6. It really won't interfere with anything using .NET <= 3.5 right now.
Change your code to .NET 3.5 and just make it work (some features have Begin and End methods to achieve some sort of asynchronous operations, but not all)
Change your code to use .NET Core (and target .NET Core) so you can use all the newest stuff, without having to update the .NET Framework (you copy over only the .NET Core DLLs that you use into the application's folder). Read about self-contained deployments here.

What does it really mean to target a framework, and how do I maximize compatibility?

Greetings all,
This has confused me ever since I first started coding in C#. My goal is to create an assembly that will run on the most recent .NET framework the user has, whatever that may be. I don't want to require .NET 4 to be installed, but I want to use it if the user has it, and more importantly, I want it to still work if the user has only .NET 4 and nothing below. I'm beginning to suspect this is not even possible.
I don't really understand what I'm selecting when I change the "Target Framework" in Visual Studio. Does that mean "will be compatible with this version and up"? Or "will be compatible with only this version"? It seems like it's the latter so far; my tests in virtual machines show .NET 4 targeted assemblies failing without .NET 4, and .NET 3.5 targeted assemblies failing without .NET 3.5. Is there no way to set this so I can achieve maximum compatibility?
UPDATE: To clarify, I have a program that targets .NET 2. The posters here seem to indicate that it should load with .NET 4. But in an environment with only .NET 4 and nothing before it, it fails to load.
UPDATE2: Okay, figured it out, but it's far more complex than the posters here seem to think. I'm opening a different question to discuss the intricacies, but the short version is, you need an app.config with <supportedRuntime version="v4.0" /> in it if you want to run non-.NET 4 assemblies on .NET 4. They won't load without it.
The frameworks are designed to be backwards-compatible; if you have a program written in .NET 2.0, you can run it in the 4.0 runtime, because none of the frameworks ever remove functionality that a prior version had (which is why we still have the non-generic collections like ArrayList, even though they're deprecated in favor of generic collections). However, the reverse is not necessarily true; a 4.0 app is not guaranteed to run in 2.0, because it MAY take advantage of new features of the new runtime that are not available in prior versions. In any case, if you want your app to attempt to run on runtime versions it does not specifically target, you must specify that in the app.config using SupportedRuntime elements.
To answer your specific question, you can do what you want with the following basic procedure:
Develop your app to target the EARLIEST framework version that you want to support. This will disable access to newer features of newer runtimes (like Linq in 3.5, and dynamic typing in 4.0) ensuring your app will not require any feature that cannot be provided by any of the supported runtimes.
Specify the frameworks that are acceptable to your application by using the SupportedRuntime element in your app.config file. This will tell the native code that initializes the runtime in which your app will run that if it can't find the targeted version, any of the others are acceptable. I believe the behavior is to look for the targeted framework first, and if not available it should use the newest supported runtime.
.NET is backward-compatible, this means if you select .NET Framework 2.0 as target framework, it will run on installed version 2.0, 3.0, 3.5 and 4.0.
But if you select e.g version 4.0 as target framework, it will only run if you have version 4.0 installed.
I believe this is supposed to be whatever version you select and upwards. So if you target 2.0 framework, it should work if client has 2.0, 3.0, 3.5, or 4.0 frameworks installed.
You are also selecting language features when you pick this, so I know of no way that you would be able to use 4.0 framework features using an application targeting 2.0 framework. Even dynamically loading assemblies doesn't work, try loading a dll compiled to 4.0 from a 2.0 application, it won't let you.
Here is how targeting works: If you target .NET 3.5, it will not run if user does not have .NET 3.5. It will run if user has any higher version.
For maximum compatibility, choose .NET 2.0, it will run even on .NET 3.5, 4.0 and so on.
However, you might loose out on new features of .NET such as LINQ etc.
http://msdn.microsoft.com/en-us/library/bb398197(VS.100).aspx
Can I still target .NET Framework 2.0 in VisualStudio 2010?

Will .NET Framework 1.x apps run on PC's with .NET 4.0 only?

Basically, i am trying to determin if an application made for 1.x will run on a computer with just one copy of the .NET framework installed which is a higher version than what i am targetting, ie: it only has one copy of .NET 2.0, or 3.0, or 3.5 or 4.0 - has one copy of either of these and thats it, the hypothetical computer would not have 1.0 or 1.1 installed.
Trying to determine if 1.0 or 1.1 app would run here - the app is a simple app and im just trying to get the largest reach possible without the need to install the framework (and yes, i realize the frameworks are really small now days at about 40mb, but this is still not an option for me). thanks
an aside: btw, i have googled this to no avail, do we have or does anyone know adoption stats in terms of % of windows computers that run (say) 2.0, 1.x, 3.5 etc... or 2.0 and above, or 1.x and above? there is a reference on scott hanselmans blog but this seems really optimistic and incorrect to me as i did some user-string analysis of common users, and adoption of 2.0+ was barely above 50% while hanselmen said according to windows update data it was 95% (and this was in janruary 2010).
Edit\Update Could someone please confirm if Nayan's answer (and Daniels point under Darins answer) is correct? If so, this would change everything!
Yes it will run fine if you have a higher version of the framework installed. It is backwards compatible. But in the end of 2010 there's very little sense in still keeping applications targeting .NET 1.*. You could at least recompile them to target the .NET 2.0 if not .NET 3.5 or 4.0.
To answer your aside the wikipedia page shows what versions of windows have what version of .net pre-installed by default
To answer your main question. I know 100% that if you have 3.5 it will run 1.0-3.5 with just that installed. However I do not know if that is true for 4.
You should not have any problems running your application on .net 1+ frmaeworks.
. Net has been designed to always be backwards compatible. This means if we get to later versions it will still work.
It also means if the Microsoft team make a mistake it will still be there just a better way will be available
I don't think the question is very clear. I'll explain:
If you are asking if the application is already built on .NET 1.x and you are trying to run it in any other version, it will not work. It would need the same version.
But if you still have the code and are willing to recompile it on newer .NET versions, then you will have a newer .NET version compatible app!
What, I feel, missing in your question is that whether you are talking about built up apps or source codes.

C# .NET 2.0 components

How can I check what objects, tools, variables, anything... are used from .NET 2.0 in a C# application.
How can I get a C# application run without .NET 2.0 ?
UPDATE:
sorry, I didn't clarify enought. Here's my situation: I have developed a pretty simple application in C#: embeded browser which displayes static webpages with an option of searching inside of these html pages. I'm using simple textbox, buttons components for this.
The application will be distribuited for people wich have very old PCs, even with windows 95. I would like the app to be runable on it, or at least on win 98, without telling the people to install .NET 2.0, as the users don;t really have PC usage skills :) .
I'm using a dataGridView as well.
You can have a look at this : http://www.remotesoft.com/linker/
"The mini-deployment tool puts
together the minimum set of CLR
runtime files and dependent assemblies
that can be simply copied to a single
folder on a target machine, and your
application runs as if the whole
framework is installed. Since the
installation is isolated into a single
folder, there will be no conflicts
with future .NET installation. When
linking is used for the dependent
assemblies, it will further reduce the
file size."
You may need to clarify a bit more.. do you want the app to run without .Net at all? Or you want it to run in .Net 3.5 without .net 2.0 bits?
If its the latter, then simply don't reference assemblies that are compiled in .net 2.0 (check the properties on the reference you have added). If its the former, then its really not feasable. Yes its possible, but it means deploying parts of the framework with your app, but then, you'd be deploying all the bits, including the 2.0 bits.
Your're question really needs more information though, it doesn't make much sense currently. Sorry. =)
To make sure it runs without .NET 2.0, compile it with the .NET 1.1 compiler.
But this seems like not a good idea. I'd recommend revisiting your requirements.
Win98 wasn't shipped with .NET. Using .NET v1.1 won't get you much more platform penetration than .NET 2.0, if any.
IT looks like windows 98 supports the .net framework. See this answer for details:
OS Compatibility for various .NET Framework versions
You cannot run a .NET application (i.e., that uses the CLR) if you haven't installed the corresponding .NET Framework binaries (i.e., that contains the CLR) directly or indirectly.
Period.

Differences between .NET versions (predominantly c#)

Ive recently been asked to recommend a .NET framework version to use in a (GUI based) project for an XP machine.
Can anyone explain the differences between all the .NET versions?
OR,
Does anyone have a good reference to a site that details (briefly) the differences?
Jon Skeet's book C# In Depth has one section describing versions of .NET in details.
The only reason to not go for the latest version is that it can complicate deployment.
.NET 2.0 is installed automatically via Windows Update, so you can expect it to be on the target computer when your deploy your application. .NET 3.5 is not being pushed automatically yet, so you need to distribute the framework with your application. This will probably change in the near future.
If you are not concerned about deployment, then go for the latest version. The fact that you target the .NET 3.5 framework, does not mean that you have to use all the new technology. For instance you can still use Windows Forms instead of WPF, but that is another question.
The short answer is that it depends.
.NET 2.0 is the oldest version you should be considering.
.NET 3.0 is an easy upgrade path from 2.0, not the same amount of breaking changes as from 1.1 to 2.0. However it is more of an extension, horizontally of functionality, and you would not see a huge shift in graphical options.
.NET 3.5 should be looked at if you are interested in much more sophisticated gui such as sliverlight. It has a lot more new technologies and options to offer including WPF, a new IDE in Expression and much more. http://www.asp.net would not be a bad start.
This page is good for a list of changes:
http://en.wikipedia.org/wiki/Microsoft_.NET
As someone has already mentioned, .NET 2.0 is the minimum version you need to look at. Things like Generics make it a must have.
.NET 3.5 is the other version you should consider. It depends on how you want to design your projects, .NET 2.0 is very developer central, whereas .net 3.5 has a good split between designer and developer.
It doesn't really matter much. .NET 2.0, 3.0 and 3.5 all use the exact same CLR and base classes. Each version just adds a set of new assemblies. For GUI development, you're fine with 2.0 if you use Windows Forms, you'll need 3.0 for WPF. Since they are otherwise essentially identical, there is no good reason to not just install 3.5 SP1.

Categories

Resources