Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I upgrade multiple projects (same solution) that's targeting 3.5 to 4.0 in one go?

In one big solution we have about 100~ projects all targeting 3.5 and currently in VS.NET 2010.

Now we want to upgrade it to .NET 4.0, do I have to go one by one and change their target? or is there any way to automate this process?

like image 741
dr. evil Avatar asked Apr 02 '11 15:04

dr. evil


4 Answers

The Target Framework Migrator extension works great.

After you install it simply go to Tools -> Target Framework Migrator

like image 88
Matt Avatar answered Nov 16 '22 01:11

Matt


When upgrading many projects and similar operation I usually use Find and replace in files.

First I upgrade one project and diff the result, then I search and replace relevant parts in my .csproj files.

like image 34
Albin Sunnanbo Avatar answered Nov 16 '22 01:11

Albin Sunnanbo


Yes. You will have to change them each to use .Net 4.0 .

Or you could make a script that changed all the project files' text and change the supported framework. But, it would take more time than just go trough them all and change them.

Just note that you don't have to do that. There's backwards compatibility.. projects compiled to work with .Net 3.5 will work with .Net 4.0

Only thing you really need to do is change the setup project to include .Net 4.0 as a prerequisite .

Other than that, you don't need to change the framework until you actually want to use something from the new framework.

like image 43
Yochai Timmer Avatar answered Nov 16 '22 02:11

Yochai Timmer


I'm not sure about moving from 3.5 to 4.0, but in case you're upgrading from 2.0 to 4.0, you'll see that VS2010 actually added a default app.config file (in case you didn't have your own), which means that you'll also have to copy this file to each of the projects. Also, in case you have some *.designer files, those may change as well, so you'll have to update accordingly...

To summarize, here's the procedure:

  1. Upgrade one project and diff the changes on all files (I find that using source control is best applied for this)
  2. write a script/tool that enumerates over the entire solution and... a. Copies app.config to each of the project folders b. Changes the *.*proj files to match the diff for p.1 c. Changes the rest of the files if needed
like image 20
De'Boss Avatar answered Nov 16 '22 01:11

De'Boss