5

こんにちは、Visual Studio Express C++ プロジェクトをセットアップしました。含まれているヘッダーとライブラリへのパスを使用しています。今、このプロジェクトを複製して、含まれているヘッダーとライブラリへのパスを同じにするのが好きです。ただし、名前が異なるため、手動で . vcproj ファイルを開き、名前の変更を開始する より良い方法はありますか?

4

2 に答える 2

10

おそらくこれを行う最も簡単で最速の方法は、Windows エクスプローラーを使用してプロジェクト全体のコピーを作成することです。ほとんどの場合、コピーした .vcproj ファイルに新しい一意の GUID を割り当てる必要があります。ProjectGUIDこれを行うには、メモ帳でファイルを開き、新しいguidgen.exeアプリケーションまたは同様のアプリケーションに貼り付けます。これが完了したら、複製したプロジェクトを Visual Studio で開き、名前を変更するだけです。

別の方法として、 CopyWizなどを試すこともできます(私は使用したことがありませんが、無料の試用版を利用して、それが機能するかどうかを確認してください)。

新しいプロジェクトのテンプレートを作成しようとしている場合を除き、その場合はより良い方法があります.

于 2010-11-20T13:40:23.510 に答える
1

Powershell(Win 7などに付属)で実行した場合に機能するこれを作成しました。正しく機能しない場合でも、開始点として適している場合があります。

# set the initial values. 
[System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)
[Windows.Forms.MessageBox]::Show(“This script assumes that each project lives in a directory with the same name as the project, as VC defaults to. Input a) the directory holding both the existing project and the new project. This is the directory CONTAINING the directory with the name of the existing project. It must include the final backslash. b) the name of the existing project. c) the name of the new project”, “”, [Windows.Forms.MessageBoxButtons]::OK,     [Windows.Forms.MessageBoxIcon]::Information)
($myroot=(Read-Host "Enter path of directory holding new and existing projects."))
($projectname=(Read-Host "Enter the name of the project to copy. Must be a single word"))
($newname=(Read-Host "Enter the name of the new project. Must be a single word"))

# make a copy of the original
Set-Location $myroot
Copy-Item "$myroot$projectname" "$myroot$newname" -recurse


# find and rename all files containing the original project name
# run without recurse first or an error occurs
Get-ChildItem $myroot$newname\ -force| Where-Object {$_.name -like "*$projectname*"}| rename-item -newname { $_.name -replace "$projectname","$newname" }
Get-ChildItem $myroot$newname\ -force -recurse| Where-Object {$_.name -like "*$projectname*"}| rename-item -newname { $_.name -replace "$projectname","$newname" }

# find all references within the code to the projectname and change those
Set-Location $myroot$newname
Get-ChildItem  -recurse | where {$_.extension -eq ".cpp"-or $_.extension -eq ".h" -or $_.extension -eq ".sln" -or $_.extension -eq ".vcxproj" -or $_.extension -eq ".rc"} `
|foreach-object {(get-content $_.fullname) | foreach-object {$_ -replace "$projectname", "$newname"} | set-content $_.fullname}

# delete sdf and suo files
remove-item $myroot$newname\$newname.suo -force
remove-item $myroot$newname\$newname.sdf -force


#done
于 2011-08-19T20:19:48.987 に答える