我正在尝试在签入可视源安全文件之前将 LABEL(不是评论,它有效)应用于 VSSItem。
我已经测试了许多参数,检查了文件类型等。
我可以毫无问题地正确签入文件并添加作为签入方法属性的注释。我无法做的是添加标签....
vssItem.Label(msg1, msg2)
msg1 和 msg2 只是在 for stmt 之上定义的字符串。
For Each vssItem As IVSSItem In vssFolder.Items(False)
Console.Write(" {0}", vssItem.Name)
Dim localPCpath As String = "C:\..\..\Projects\test\newtest"
Dim localpath As String = Path.Combine(localPCpath, Path.GetFileName(vssItem.Name))
**vssItem.Label(msg1, msg2)**
vssItem.Checkin("Test 11 of checkin with label", localpath)
If DirectCast(vssItem.IsCheckedOut, VSSFileStatus) = VSSFileStatus.VSSFILE_NOTCHECKEDOUT Then
Console.WriteLine(vssItem.Spec + " is checked in.")
Else
Console.WriteLine(vssItem.Spec + " is checked out.")
End If
Next
报告的错误是......
System.Runtime.InteropServices.COMException 未处理
错误代码=-2147352566
HelpLink="ssusexp.hlp#10170"
Message="无效的访问代码(错误的参数)。"
来源="来源安全"
堆栈跟踪:
at Microsoft.VisualStudio.SourceSafe.Interop.IVSSItem.Label(String Label, String Comment)
at DBConversionUpdate.testSS.Button2_Click(Object sender, EventArgs e) in C:\..\..\Documents\Visual Studio 2008\Projects\DBConversionUpdate\DBConversionUpdate\testSS.vb:line 209
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at DBConversionUpdate.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
内部异常:
我还要说,我知道这是旧软件,很多人认为 MS Source Safe 是垃圾,但我现在坚持使用它。