Unable to create SourceSafe Object
I'm currently using VSS2005. I did register ssapi.dll by "regsvr32 ssapi.dll"; however, I got error: "could not create object named "SourceSafe" from vbscript below. Please help.
Set
oVSSDatabase = WScript.CreateObject("SourceSafe")oVSSDatabase.Open (
"C:\VSSData\srcsafe.ini")Set
oVSSItem = oVSSDatabase.VSSItem("$/Test/testingfile.cs")oVSSItem.Parent.LocalSpec =
"C:\Projects"oVSSItem.Get
Answers
Do you get any other error code that may help pinpoint the problem?
You may need to look in registry at the following key HKEY_CLASSES_ROOT\SourceSafe. If you're working with VSS 2005, it should look like this:
[HKEY_CLASSES_ROOT\SourceSafe]
@="Microsoft Visual SourceSafe Automation"
[HKEY_CLASSES_ROOT\SourceSafe\CLSID]
@="{783CD4E4-9D54-11CF-B8EE-00608CC9A71F}"
[HKEY_CLASSES_ROOT\SourceSafe\CurVer]
@="SourceSafe.8.0"You can also try creating directly the VSS 2005 automation object:
Set oVSSDatabase = WScript.CreateObject("SourceSafe.8.0")
Alin
All Replies
Do you get any other error code that may help pinpoint the problem?
You may need to look in registry at the following key HKEY_CLASSES_ROOT\SourceSafe. If you're working with VSS 2005, it should look like this:
[HKEY_CLASSES_ROOT\SourceSafe]
@="Microsoft Visual SourceSafe Automation"
[HKEY_CLASSES_ROOT\SourceSafe\CLSID]
@="{783CD4E4-9D54-11CF-B8EE-00608CC9A71F}"
[HKEY_CLASSES_ROOT\SourceSafe\CurVer]
@="SourceSafe.8.0"You can also try creating directly the VSS 2005 automation object:
Set oVSSDatabase = WScript.CreateObject("SourceSafe.8.0")
Alin
Thanks it works.
Could you please point me to some resources that have sample vbscript?
I don't know of any samples that use VSS/vbScript, but I don't think that using VSS from VB should be much different from VBScript.
I'd probably take a closer look at IVSS interface functions (http://msdn2.microsoft.com/en-us/library/microsoft.visualstudio.sourcesafe.interop.aspx) and at VB automation sample (http://www.microsoft.com/downloads/details.aspx?FamilyID=1efdb5a1-317c-49b3-82f3-ed2f70481cca&DisplayLang=en)
Alin
Alin,
Thanks, I got my script working; however, I search for entire document on msdn. I can't find and return code for VSSItem
VssItem is an object. Are you talking about return code from VssItem.Get function?
Get() doesn't have any return code - it gets the file locally if the local file doesn't exist or if it's different than database's version. If you need to know beforehand if Get will do anything you'll have to call IVssItem.IsDifferent, or File.Exist (whatever is its equivalent in VBScript)
Alin
- Got it thanks


