views:

101

answers:

5

Hello !

I would like to know how can i transform a .NET 4.0 VS 2010 C# project intro a 3.x .NET version? I just made an app for someone and i don't think he has the .NET 4.0 platform installed . Any ideas?

A: 

The easiest way is to create a new Visual Studio 2008 project with your requirements (.NET version, namespace, etc) and just copy all sources from your Visual Studio 2010 project to that project. The solution explorer has an option that shows all files in your project that are not included, and you can include these files in your project by right clicking on the files and selecting "Include in project." Then just compile and see what problems you get.

Pieter
i think i'm gonna go with .net 4.0 . i'll install it and that's it . Regards!
Badescu Alexandru
+2  A: 

No, you cannot do it directly. You have three options:

  • create a new project file that targets the 3.x framework and add the files to it (make sure they are not using v4.0 features)
  • get your friend to install the v4.0 framework - it is roughly 50MB, not really that big
  • as Jon pointed out, just retarget your project to v3.x in your VS2010 IDE (in the solution explorer, right click on your project, select Properties, go to the Application tab, use the Target framework dropdown)

if you have completed a reasonable amount of code it may be simpler to just install the new version of the framework.

slugster
Why do you believe that just changing the target framework of the project wouldn't work?
Jon Skeet
@Jon - very good point, i forgot that option. Duh. Answer edited.
slugster
i think i'll just install .net 4.0 . regards, Alex Badescu
Badescu Alexandru
+7  A: 

Change project target framework to 3.5 might work unless your using some 4.0 specific things.

Or make sure that the user has 4.0 installed if possible.

Fredrik Leijon
+1  A: 

Change the target framework.

But if you want to use it in Visual Studio 2008 (the URL of your question suggests it), then:

Open the sln file with notepad, and change the following line:

Microsoft Visual Studio Solution File, Format Version 11.00

to:

Microsoft Visual Studio Solution File, Format Version 10.00

netadictos
2 minutes ago the URL was http://stackoverflow.com/questions/3957633/vs2010-to-vs2008
netadictos
If this is a simple project, where the sln really contains only a reference to the csproj file, it would be easier if the friend just deleted the sln file and open the csproj file directly in VS2008. Then, save as sln file in the VS2008, which will give you the right format. But remember, you still must change the target framework to 3.5 before you give it to your friend, so that the project file gets right.
awe
thanks! i think it's better t install the .net 4.0 if it only has 50 mb. this way i'm sure it'll work.
Badescu Alexandru
A: 

Use the "Properties" from the project and select the version of the framework in "Target Framework", that is needed. sorry for my English :)

us50