Jason
Jason

Reputation: 8640

How do I prevent Visual SourceSafe from writing the vssver2.scc file when getting a file with Microsoft.VisualStudio.SourceSafe.Interop?

I get a file from Visual SourceSafe using the below code:

IVSSItem vssFile = vssDataBase.get_VSSItem(vssFilePath + @"/" + fileName, false);

VSSItem itemVer = vssFile.get_Version(latestVersionNumber);
itemVer.Get(ref getFilePath, (int)VSSFlags.VSSFLAG_FORCEDIRNO | (int)VSSFlags.VSSFLAG_REPREPLACE | (int)VSSFlags.VSSFLAG_USERRONO);

Visual SourceSafe adds a vssver2.scc file to each folder. Is there a way to prevent this from happening?

I've tried various combinations of the VSSFlags enum with no luck. I don't need to preserve any history and the file will never be checked back in. I just want a clean checkout.

Obligatory disclaimer: I can't switch to another source control program.

Upvotes: 1

Views: 1476

Answers (1)

Jason
Jason

Reputation: 8640

I realized my interest in getting files cleanly via SourceSafe.Interop was more aesthetic than practical. I'm still interested in a solution but I ended up doing this after all the files were checked out.

foreach (FileInfo visualSourceSafeFile in testDirectoryInfo.GetFiles("*.scc", SearchOption.AllDirectories))
{
    visualSourceSafeFile.Attributes = FileAttributes.Normal;
    visualSourceSafeFile.Delete();
}

If you don't change the file attribute to Normal before you delete, you'll probably run into exceptions. Visual SourceSafe marks them as Hidden, System, and ReadOnly.

Upvotes: 1

Related Questions