views:

118

answers:

6

I used VS2010, and target for .Net 2.0 (VB.Net Windows Form application)

http://stackoverflow.com/questions/2171980/how-to-decide-what-is-the-net-target I decided on 2.0 because I understood it will be OK if the users have higher version

I tested my app on XP with .Net 2.0, works fine.

I uninstalled .Net 2.0 [to see what error message users might get]

[a few files were still left in C:\Windows\Microsoft.Net\Framework\v2.0.50727 but not all files]

I installed .Net 4 [. . . also needed to install Windows Installer 3.1, and Windows Imaging Component, as pre-requirments . . .]

but now when I run my app I get the error - "unable to find a version of the runtime to run this application"

so what should I recomend my clients? to install 2.0?

Thanks,

Atara

Update: I am going to recommend my XP users to install .Net 3.5 SP1

+7  A: 

A .NET 2.0 application needs .NET 2.0 to run. A .NET 3.0 or 3.5 application only needs .NET 2.0 plus whatever additional .NEt 3.0/3.5 assemblies it actually uses.

A .NET 4.0 application needs the .NET 4.0 CLR, so .NET 4.0 must be installed.

John Saunders
my NET 2.0 application run well on Windows 7 and on Vista, so what version of .Net should I tell my XP users to install?
Atara
@Atara: Vista includes 3.0 and Win7 even 3.5. You can ask to install 2.0 or, as said in another anwser, 3.5 SP1.
wRAR
A: 

The moment is build the project, try to access its properties and change the "Target Framework". And select the framework that your clients have. This may solve your problem.

Ph.E
+3  A: 

You have two choices:

  • Recommend your clients install .NET 3.5 SP1 (nobody installs .NET 2.0 anymore)
  • Target .NET 4.0 and ask your clients to install .NET 4.0 (this might not be accepted very well especially if your clients are some large corporations where company policy doesn't allow it)
Darin Dimitrov
and .NET 3.5 SP1 will work?I tested my app on Vista, and on Windows 7, and had no problems. I didnot think that XP will cause errors . . .
Atara
Yes it will work, .NET 3.5 uses CLR 2.0 which is the same as .NET 2.0, so no problems running your application.
Darin Dimitrov
A: 

Just because you installed .NET 4.0 doesn't mean your application was targeting .NET 4.0.

If you modify your project settings in Visual Studio to build to target .NET 4.0 and you should no longer get the error (but then your clients will need to install the .NET 4.0 Runtime).

Personally, if you want to release something that is going to run on the majority of client machines already out there, I would target .NET 3.5. Most people are going to have the runtime installed already.

If not, it's easy enough to download from Microsoft.

.

Justin Niessner
A: 

You should build an installer (a Setup/Deployment project in Visual Studio) that includes the 2.0 redistributable so that when your clients install your software it will install the necessary .net framework for it to run.

Task
+1  A: 

Here's a brief overview of which framework is required on select windows OSes [which in my opinion are more commonly encountered].

  • XP: 2.0, 3.0, 3.5, 4.0
  • Vista: 3.5, 4.0
  • Win7: 4.0

As you can see, Microsoft has the frameworks that were already released as of when an OS was being released preinstalled.

It is also worth noting that when you install .NET 3.5 sp1, you automatically get 3.0 and 2.0 installed. This is because they all run on the same underlying framework and each version builds on the previous.

.NET 4 is a completely different animal. It runs on a different underlying framework so you don't automatically get the older versions of the .NET framework when you install it.

Hope this helps.

Alex Essilfie