VSSリポジトリのコピー

 VSSのデータディレクトリをコピーして、コピー後のソリューションを開こうとしたのですが、一部のプロジェクトが読み込まれませんでした。

 slnファイルを開いて、ざっと見る限り、

Global
	GlobalSection(SourceCodeControl) = preSolution

 の下には、プロジェクトの情報が並んでいます。ここには

  • SccProjectUniqueName
  • SccLocalPath
  • SccProjectFilePathRelativizedFromConnection
  • SccProjectName

 というエントリらしき文字列がありますが、SccProjectFilePathRelativizedFromConnectionとSccProjectNameは排他的らしく、片方があると片方がない。で、コピーしたVSSのソリューションを開くときに、SccProjectFilePathRelativizedFromConnectionがあるプロジェクトはちゃんと読み込まれるのですが、SccProjectNameがあるプロジェクトは、読み込まれないようです。SccProjectNameに元のVSSのディレクトリ名が入ってしまっているせいでしょうね。

 すべてのSccProjectNameを、SccProjectFilePathRelativizedFromConnectionに変えてしまえば読み込めるのかもしれません(が、保障は出来ません)

 と思っていたら、英語ですが情報がありました。このサイトに寄れば、

the solution file specifying an absolute path to the project file in source control. This can be fixed by manually editing the .sln file and doing fixups on the SccProjectName = $/Blah lines. There are two ways for slns to specify the source control path to a given project. One is the absolute method, which uses the SccProjectName = $/Fully/Qualified/SourceVault/Path setting line, the second is the relative method, which uses the SccProjectFilePathRelativizedFromConnection = RelativePathFromSolutionFileInSourceVault setting line and seems to go hand in hand with the setting SccLocalPath = .. Checking the file out using Vault, then editing it by hand in notepad, with DevEnv still open, verifying each change by switching back to DevEnv and choosing to "Reload" the solution, worked well. DevEnv was very tolerant of my mistakes in numbering the config settings; it seems to honour ordering over the number you give to the settings.

 というわけで、SccProjectNameは絶対パス、SccProjectFilePathRelativizedFromConnectionは相対パス。ここにも手で書き換えろ、って書いてますから、書き換えれば出来るかもしれません。

 あ、相対パスに替える場合はついでに

SccLocalPath10 = Hoge

などとなっているところを

SccLocalPath10 = .

にしましょう。