powershell: Upgrade All Your .Net Projects

Here’s a quick PowerShell script you can use to update all your projects to a new version of .Net. Lots faster than opening the properties window for each project in Visual Studio and then reloading.


	function set-frameworkversion($version) {
		#scan current directory and below for project files
		#Add project types as desired
		$projects = dir -r . -include *.csproj,*.fsproj;
		$projects | % {
			$x = [xml](gc $_);
			$x.project.propertygroup[0].TargetFrameworkVersion = $version;


Use like this: set-frameworkversion 'v4.5'


If anyone knows a better way or has corrections, please share!

No Comments