|
It is a wonderful tool for visual studio developers!
Thank you for make it available!
Sincerely,
Sofia
|
|
|
|
|
example of use: proj_rename.pl -if project1.dsp -on project2 -iw project1.dsw -ow project2.dsw -up -uw
#
# ProjRename v1.1.1
#
# (C) 2003 Alexander Dovgaluk (sshd@mail.ru)
#
# utility for renaming visual studio projects
# supported file-types: dsp, vcp, vcproj, vcw, dsw, sln
#
# Started: 07.11.2003
# Last Update: 10.11.2003
#
use strict;
my $me;
if ($0 =~ m;^(.*[/\\])?(.*)$;) {
$me = $2;
} else {
$me = $0;
}
sub PrintUsage
{
print <<"_EOF_";
Visual Studio projects rename utility
Usage: $me options
-up update project file
-if <filename> input project file
-of <filename> output project file
-in <name> input project name
-on <name> output project name
-uw update workspace file
-iw <filename> input workspace name
-ow <filename> output workspace name
_EOF_
};
if ($#ARGV < 0) {
PrintUsage;
exit 1;
}
my @args;
my $input_fname;
my $input_ext;
my $in_pr;
my $in_pr_guess;
my $in_pr_file;
my $output_fname;
my $output_ext;
my $out_pr;
my $out_pr_file;
my $pr_type;
my $update_project;
my $input_workspace;
my $output_workspace;
my $update_workspace;
my $input_ws_ext;
my $ws_type;
$input_fname = "";
$input_ext = "";
$in_pr = "";
$in_pr_guess = 1;
$in_pr_file = "";
$output_fname = "";
$output_ext = "";
$out_pr = "";
$out_pr_file = "";
$pr_type = "";
$update_project = 0;
$input_workspace = "";
$output_workspace = "";
$update_workspace = 0;
$input_ws_ext = "";
$ws_type = "";
@args = @ARGV;
while (@args) {
my $cmd;
$cmd = shift @args;
if ($cmd eq '-if') {
$input_fname = shift @args;
} elsif ($cmd eq '-of') {
$output_fname = shift @args;
} elsif ($cmd eq '-in') {
$in_pr = shift @args;
$in_pr_guess = 0;
} elsif ($cmd eq '-on') {
$out_pr = shift @args;
} elsif ($cmd eq '-pt') {
$pr_type = shift @args;
} elsif ($cmd eq '-iw') {
$input_workspace = shift @args;
} elsif ($cmd eq '-ow') {
$output_workspace = shift @args;
} elsif ($cmd eq '-wt') {
$ws_type = shift @args;
} elsif ($cmd eq '-up') {
$update_project = 1;
} elsif ($cmd eq '-uw') {
$update_workspace = 1;
}
}
$input_ext = $pr_type if $pr_type;
$input_fname = "$in_pr.$input_ext" if not $input_fname and $input_ext and $in_pr;
if ($input_fname =~ m!^(.*[/\\])?(.*)\.(.*)$!) {
$in_pr_file = $2;
$input_ext = $3;
}
$in_pr = $in_pr_file if not $in_pr;
$in_pr_file = $in_pr if not $in_pr_file;
if ($input_workspace =~ m!^(.*[/\\])?(.*)\.(.*)$!) {
$input_ws_ext = $3;
}
if ($update_project and not $pr_type) {
if ($input_ext =~ /^dsp$/) {
$pr_type = "dsp";
} elsif ($input_ext =~ /^vcp$/) {
$pr_type = "vcp";
} elsif ($input_ext =~ /^vcproj$/) {
$pr_type = "vcproj";
} else {
die "Unknown project file extension";
}
}
if ($update_workspace and not $ws_type) {
if ($input_ws_ext =~ /^dsw/) {
$ws_type = "dsw";
} elsif ($input_ws_ext =~ /^vcw/) {
$ws_type = "vcw";
} elsif ($input_ws_ext =~ /^sln$/) {
$ws_type = "sln";
} else {
die "Unknown workspace file extension";
}
}
$output_fname = "$out_pr.$input_ext" if not $output_fname;
if ($output_fname =~ m!^(.*[/\\])?(.*)\.(.*)$!) {
$out_pr_file = $2;
$output_ext = $3;
}
$out_pr = $out_pr_file if not $out_pr;
$update_project = 0 if not $input_fname or not $output_fname;
$update_workspace = 0 if not $input_workspace or not $output_workspace;
# warning if ($input_ext !~ /^\Q$output_ext\E$/);
# warning if ($input_ws_ext !~ /^\Q$output_ws_ext\E$/);
my $s;
if ($update_project or $in_pr_guess) {
open(IN, "<$input_fname") or die "Can't open input project file";
if ($update_project) {
open(OUT, ">$output_fname") or die "Can't open output project file";
}
if ($pr_type eq "dsp" or $pr_type eq "vcp") {
my $is_project;
my $is_beginning;
my $is_currcfg;
my $is_target;
$is_beginning = 1;
$is_currcfg = 1;
$is_project = 0;
$is_target = 0;
while ($s = <IN>) {
if ($s =~ /^# Begin Project$/) {
$is_project++;
$is_beginning = 0;
$is_currcfg = 0;
$is_target = 0;
} elsif ($s =~ /^# End Project$/) {
$is_project--;
$is_target = 0;
}
if ($is_beginning) {
if ($in_pr_guess) {
if ($s =~ s/^(# Microsoft (Developer Studio|eMbedded Visual Tools) Project File - Name=")(.*)(" - Package Owner=<.*>)$/$1$out_pr$4/) {
$in_pr = $3;
$in_pr_guess = 0;
$is_beginning = 0;
}
} else {
if ($s =~ s/^(# Microsoft (Developer Studio|eMbedded Visual Tools) Project File - Name=")\Q$in_pr\E(" - Package Owner=<.*>)$/$1$out_pr$3/) {
$is_beginning = 0;
}
}
} elsif ($is_currcfg) {
if ($s =~ s/^(CFG=)\Q$in_pr\E( - .*)$/$1$out_pr$2/) {
$is_currcfg = 0;
}
} elsif ($is_project > 0) {
if ($s =~ /^# Begin Target$/) {
$is_target++;
} elsif ($s =~ /^# End Target$/) {
$is_target--;
}
if ($is_target > 0) {
$s =~ s/^(# Name ")\Q$in_pr\E( - .*")$/$1$out_pr$2/;
}
$s =~ s/^(!(ELSE)?IF\s*"\$\(CFG\)"\s*==\s*")\Q$in_pr\E( - .*?")$/$1$out_pr$3/;
} else {
$s =~ s:^(!MESSAGE NMAKE /f ")\Q$in_pr_file\E(\.(mak|vcn)"\.)$:$1$out_pr_file$2:;
$s =~ s:^(!MESSAGE NMAKE /f ")\Q$in_pr_file\E(\.(mak|vcn)" CFG=")\Q$in_pr\E(.*?")$:$1$out_pr_file$2$out_pr$4:;
$s =~ s/^(!MESSAGE ")\Q$in_pr\E( - .*?".*)$/$1$out_pr$2/;
}
print OUT $s if $update_project;
}
} elsif ($pr_type eq "vcproj") {
my $is_project;
my $is_end;
$is_project = 0;
$is_end = 0;
while ($s = <IN>) {
if (not $is_end) {
if ($s =~ /^<VisualStudioProject$/) {
$is_project = 1;
}
if ($is_project) {
if ($in_pr_guess) {
if ($s =~ s/^(\s*Name=")(.*)("\s*)/$1$out_pr$3/) {
$in_pr = $2;
$in_pr_guess = 0;
$is_end = 1;
}
} else {
if ($s =~ s/^(\s*Name=")\Q$in_pr\E("\s*)/$1$out_pr$2/) {
$is_end = 1;
}
}
}
}
print OUT $s if $update_project;
}
}
if ($update_project) {
close(OUT);
}
close(IN);
}
if ($update_workspace) {
open(IN, "<$input_workspace") or die "Can't open input workspace file";
open(OUT, ">$output_workspace") or die "Can't open output workspace file";
if ($ws_type eq "dsw" or $ws_type eq "vcw") {
my $is_project;
my $is_package;
my $is_dependency;
$is_project = 0;
$is_package = 0;
$is_dependency = 0;
while ($s = <IN>) {
if ($is_project) {
if ($is_package) {
if ($s =~ /^\s*\}\}\}\s*$/) {
$is_package = 0;
$is_dependency = 0;
}
if ($is_dependency) {
if ($s =~ /^\s*End Project Dependency\s*$/) {
$is_dependency = 0;
}
$s =~ s/^(\s*Project_Dep_Name )\Q$in_pr\E/$1$out_pr/;
} else {
if ($s =~ /^\s*Begin Project Dependency\s*$/) {
$is_dependency = 1;
}
}
} else {
if ($s =~ /^\s*\{\{\{\s*$/) {
$is_package = 1;
$is_dependency = 0;
}
}
}
if ($s =~ /^(Project:\s*"[^"]*"=.*|Global:\s*)$/) {
$s =~ s/^(Project:\s*")\Q$in_pr\E("=.*)\Q$input_fname\E( - Package Owner=<.*>)$/$1$out_pr$2$output_fname$3/;
$is_project = 1;
$is_package = 0;
$is_dependency = 0;
}
print OUT $s;
}
} elsif ($ws_type eq "sln") {
my $is_project;
my $is_global;
$is_project = 0;
$is_global = 0;
while ($s = <IN>) {
if ($is_project) {
if ($s =~ /^\s*EndProject\s*$/) {
$is_project = 0;
}
} elsif ($is_global) {
if ($s =~ /^\s*EndGlobal\s*$/) {
$is_global = 0;
}
} else {
if ($s =~ s/^(\s*Project\("[^"]*"\)\s*=\s*")\Q$in_pr\E(",\s*".*)\Q$input_fname\E(",\s*"[^"]*"\s*)$/$1$out_pr$2$output_fname$3/) {
$is_project = 1;
$is_global = 0;
}
if ($s =~ /^\s*Global\s*$/) {
$is_global = 1;
$is_project = 0;
}
}
print OUT $s;
}
}
close(OUT);
close(IN);
}
exit 0;
|
|
|
|
|
Do you have a link to a description of this? Or how is it better?
John
|
|
|
|
|
Honestly, since this requires a Perl install, how is this better?
|
|
|
|
|
Hello I have a project named ASC DigSig EVal I wanted to chage it BSC Chic Sick DVal;P but it cant do it it just says the command line help again and again I tried it with a project namde Ascii which doesnt have spaces in it it it worked fine, I think I have to do it by hand cause Time is short and I cant wait for the reply that it cant do this
best Regards
Muhammad Aftab Alam
|
|
|
|
|
iffi992 wrote: I have a project named ASC DigSig EVal I wanted to chage it BSC Chic Sick DVal but it cant do it
Does this work:
vsrename "ASC DigSig EVal" "BSC Chic Sick DVal"
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
My project was Called "Tom". So I did a "vsrename Tom NewOne".
The project was Ok until I opened a Dialog. VC++ said me with error in XXXX.rc; I pushed the "Edit Code" button.
I saw that strings were not correctly replaced : BOTNewOneWIDTH. It was originaly BOTTOMWIDTH...
So be carefull ! It took me less than 20 seconds to correct the rc file.
Great tool, it saves me hours of renaming files and editing thos files.
Thanks.
|
|
|
|
|
This little program has saved me lots of time and headaches.
Thanks!
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Hello,
Thanks for the tool, it works (Platform Win32),
also with Solutions/projects from Visual Sudio .NET.
I remarked that the program does not detect the write-protected files.
I Solved the problem through the following changes the implementation:
sub renamer
{
my $filename = $File::Find::name;
return if ( $filename eq '.' );
return if ( -d $filename );
if ( -w $filename )
{
....... (original implementation)
else
{
print "FAILURE: $filename is write-protected, not replaced\n";
}
}
|
|
|
|
|
Firstly thanks for a great tool.
I renamed the MSDN example WIZARD97 to TSetup2. The problem came when I realised it had changed the PSH_WIZARD97 flag to PSH_Tsetup2. It was easily fixed though.
Cheers
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
I used to do this by hand! Thanks!
Father of one; Master of none Father of two; What's a guy to do?
|
|
|
|
|
Check www.daansystems.com for a GUI-version of project renamer.
Gero Gerber
|
|
|
|
|
This program saved me and my coworkers for a lot of work. Thank you!
|
|
|
|
|
I have been using your little utility alot lately. I have needed to copy and rename various projects (10+) and this little program has saved me countless hours. It has worked perfectly so far!
Thanks!
|
|
|
|
|
We have just release a new version,download at:
http://www.ucancode.net
|
|
|
|
|
I'm confused, this seems like another program.
Might be worth a try dough.
|
|
|
|
|
Excellent work. This is ideal for when marketing people decide that they 'need' to change the name of a product we've worked on for months.
Once again, excellent work.
P.S. The GUI interface would be useful though
|
|
|
|
|
ABSOLUTELY WONDERFUL!!! THANK GOD YOU PUT THIS TOGETHER!!!
Please excuse the capital letters, but I really can't say enough about this program.
(Especially after working so long on something that had a completely inappropriate project name. )
Phillip Decker
pdecker999@yahoo.com
|
|
|
|
|
Well, for me I get the same problem as adws! I'm using Windows 98. Can't for the life of me get it to do more than flash a window on the screen. Any assistance gratefully received!
Brian Scott
|
|
|
|
|
I used version v0.3 under WinNT 4: After renaming two different projects and recompiling the new ones, I always got the same linker error: defective RES-File.
I recopied all files in the res-folder except the myproject.ico, myproject.rc2, myprojectDoc.ico manually from the original project to the renamed one and the problem was gone, everything works fine!
|
|
|
|
|
I've just released a small update that should take care of
corrupted binary files.
Get v0.4 at:
http://www.daansystems.com/freestuff/
Hope it helps!
|
|
|
|
|
V0.4 works fine with one of the two projects, but not with the other one. VS6.0 SP1 crashes while loading the projects with a read access error. I use identical *.avi and *.ico files in the projects, the differences lie in the different bitmap files.
V0.3 with manual copying the res-files as described above works fine with both projects. (and identical names/pathes).
|
|
|
|
|
You probably need to do a 'Make Clean' before renaming the project.
It might help.
|
|
|
|
|
I tried it that way, but it didn't work. Thanks for the help.
|
|
|
|
|
I've just updated to v0.5, could you try that one on the binary files?
get it from:
http://www.daansystems.com/freestuff/
|
|
|
|