# This script expects the projects to already have been converted to the # Visual Studio 2010 format. If you just run it with no options it will # recurse from the current directory and find every .csproj it can and # convert it to .net 4.0. You can also specify a starting search path # (this should be done after the client switch if you use that). $search_path = "." $client_profile = [bool] 0 if($args.Length -ge 1) { if(($args[0] -eq "--help") -or ($args[0] -eq "-h") -or ($args[0] -eq "/?")) { echo "upgrade_dotnet" echo "usage: upgrade_dotnet (--client) (path)" $format = @(Expression={$_.Name}; Label="Argument"; width=10), @(Expression={$_.Value}; Label="Description";) $arguments = @{"path"="The start of the search path for .csproj files to convert."} echo $arguments | Format-Table $format } else { $search_path = $args[0] } if($args.Length -ge 2) { $search_path = $args[1] } } $projects = ls -recurse -Filter "*.csproj" $search_path foreach ($p in $projects) { $path = $p.FullName $x = [XML](gc $path) if($x.Project.PropertyGroup[0].TargetFrameworkVersion -eq "v4.0") { continue } else { $x.Project.PropertyGroup[0].TargetFrameworkVersion = "v4.0" $x.Save($path) } }