/ Published in: Perl
Some (all?) Visual Studio projects can be opened with older versions without problems once their version numbers have been reduced. The following Perl script does this; it also recurses over the projects contained in a project folder (.sln) file. It saves you upgrading all your installations.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl -w use strict; my $targetver= 9; my %veryear= ( 8 => 2003, 9 => 2005, 10 => 2008 ); my $year= $veryear{$targetver}; my $projver= $targetver - 1; sub downsln { my ($fname)= @_; } my $data= <IN>; close IN; getver.00/ $data =~ s/\n\#\s+Visual .*20\d\d/\n\# Visual Studio $year/ close OUT; } else { } my @projs= $data =~ /\nProject.*?=.*?,\s*\"([^"]+)\"/g; my $basedir= $fname; for (@projs) { downproj($basedir . $_, $fname); } } sub downproj { my ($fname, $slnname)= @_; } my $data= <IN>; close IN; $data =~ s/\n(\s*Version\s*=\s*\")\d+([,.])\d+\"/\n$1$projver${2}00\"/ close OUT; } else { } } for my $arg (@ARGV) { $arg =~ s/\\/\//g; $arg =~ s/^([a-z]):\//\/cygdrive\/$1\//i; if( $arg =~ /\.sln$/ ) { downsln($arg); } else { downproj($arg); } }