I have a solution with many, many projects. How do I change the target framework to .NET 4.0 without going to each one individually and manually changing the dropdown?
Asked
Active
Viewed 69 times
1 Answers
1
Try comparing a 3.5 project file and a 4.0 project file and use a file based search/replace operation.
I think only these two version numbers differ:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

Sandor Drieënhuizen
- 6,310
- 5
- 37
- 80
-
I've searched the whole solution and not found the strings "TargetFrameworkVersion" or "ToolsVersion" ?? – Carlos Apr 26 '10 at 13:32
-
Did you open a .csproj file in Notepad using Windows Explorer? – Sandor Drieënhuizen Apr 26 '10 at 13:33
-
No, I used the find/replace in VS2010. – Carlos Apr 26 '10 at 13:34
-
I see. I think the easiest way to go about is closing you solution (but not Visual Studio) and press Control+Shift+H to open the Find and Replace box. Look in the solution directory and all file types. – Sandor Drieënhuizen Apr 26 '10 at 13:36
-
But then how do I edit all the files? I fond this: http://www.codeproject.com/Articles/74805/Visual-Studio-2010-and-Target-Framework-Version.aspx – Carlos Apr 26 '10 at 13:41
-
The Find and Replace box you get by pressing Control+Shift+H can do that for you. Just replace `
v3.5` by ` – Sandor Drieënhuizen Apr 26 '10 at 13:43v4.0 `. -
Aha! It seems to work. The toolsversions don't need changing, because I've already opened the files in VS2010. The critical point is that the find/replace appears to work differently when you don't have a solution loaded. – Carlos Apr 26 '10 at 13:54