I used VS2010, and target for .Net 2.0 (VB.Net Windows Form application)
How to decide what is the .Net target I decided on 2.0 because I understood it will be OK if
You have two choices:
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.
.
Here's a brief overview of which framework is required on select windows OSes [which in my opinion are more commonly encountered].
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.
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.
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.
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.