Compartilhar via


VSS Automation Whitepaper

A customer recently asked,

"We are using Visual
SourceSafe for version control for one of our .NET based projects. We are
wondering if SourceSafe can be setup to automatically send out change
notification to a mailing list whenever a file is checked in? We find such a feature useful
and have been using it on our CVS system for a different project.
I searched the SourceSafe documentation, Google and msdn.microsoft.com regarding this and did not
find any relevant information. Could you please confirm if such a setting is possible and if
so how to do that?"

A member of my team responds,

"Visual Source Safe exposes an event trapping
model which exposes the before check in and after checkin events. Using this
model one could code a VSS add-in that would send mail notification on each
checkin. There is an article describing event trapping and the IVSS interface at
https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/vssauto.asp"

If you're interested in writing a check in notification
add-in for VSS, you might consider sending your notifications via NET SEND
rather than email. Of course, email is much better if you or the members of your team ever connect to the VSS database remotely.  But NET SEND
is more direct and immediate than emails and the messages won't
contribute to Inbox bloat (yuk).  I found a nifty C# method that
launches cmd.exe and runs NET SEND programmatically on ASPAlliance.com: https://www.aspalliance.com/olson/methods/SendNetSend.aspx.

Back to the VSS docs... Microsoft kann für die Richtigkeit und Vollständigkeit der Inhalte in
dieser Newsgroup keine Haftung übernehmen.

Comments

  • Anonymous
    August 10, 2003
    Two points to add:1) In VSS, you have to install the application that sends the notification on every client, or check-ins from clients without the app will not send notification (since VSS has more of a client / fileserver arch then client / server) This gets a bit annoying, especially when you update, need to reconfigure, or install a new client2) NET SEND is evil. If you don't have TweakUI, it gets to interrupt you while you work. There's no history of messages, and they're limited-length plain text.
  • Anonymous
    August 12, 2003
    Great points. Perhaps we should do something to improve the deployability of client-side administrative add-ins for VSS. I sorta like the modality of NET SEND dialogs though. I agree that the lack of message history is an issue. I'll post some code for both email and NET SEND notification systems asap. -Korby
  • Anonymous
    August 22, 2003
    http://www.sourcevizor.com/ is a commercial product that adds this functionality to VSS
  • Anonymous
    September 05, 2003
    Another possibility would be to use VSS Automation to daily check for changed files and compile a single email contains a list of those files, who checked them in, comments, etc. Come to think of it, that would be pretty handy for us to have! Hmmm......
  • Anonymous
    February 18, 2004
    I thought this would be a very useful thing to try and implement so I gave it a shot. I tried converting the VB 5 code from the whitepaper to VB.NET but it didn't work out... probably because I don't have much vb.net experience.

    When I launch VSS I get a message saying "Error loading SourceSafe add-in: VSSWormPlugin2.Plugin". I have no idea where to look to get a more detailed message.

    Has anybody been able to get this to work?

    Below is my code... maybe somebody can point out where i'm going wrong:

    <PRE>
    Option Strict On
    Imports System.IO

    Public Class Plugin

    Implements SourceSafeTypeLib.IVSSEventHandler

    Dim WithEvents VSSHandler As SourceSafeTypeLib.VSSApp

    Sub Init(ByVal pIVSS As SourceSafeTypeLib.VSSApp) Implements SourceSafeTypeLib.IVSSEventHandler.Init

    VSSHandler = pIVSS

    Dim writer As StreamWriter = New StreamWriter("c:vssPlugin.txt")
    writer.WriteLine("Plugin initiated.")
    writer.Close()

    End Sub

    Function VSSHandler_BeforeAdd(ByVal pIPrj As SourceSafeTypeLib.VSSItem, ByVal Local As String, ByVal Comment As String) As Boolean Handles VSSHandler.BeforeAdd
    VSSHandler_BeforeAdd = True
    End Function

    Sub VSSHandler_AfterAdd(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String, ByVal Comment As String) Handles VSSHandler.AfterAdd
    End Sub

    Function VSSHandler_BeforeBranch(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal Comment As String) As Boolean Handles VSSHandler.BeforeBranch
    VSSHandler_BeforeBranch = True
    End Function

    Sub VSSHandler_AfterBranch(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal Comment As String) Handles VSSHandler.AfterBranch
    End Sub

    Function VSSHandler_BeforeCheckIn(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String, ByVal Comment As String) As Boolean Handles VSSHandler.BeforeCheckin
    VSSHandler_BeforeCheckIn = True
    End Function

    Sub VSSHandler_AfterCheckIn(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String, ByVal Comment As String) Handles VSSHandler.AfterCheckin
    End Sub

    Function VSSHandler_BeforeCheckOut(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String, ByVal Comment As String) As Boolean Handles VSSHandler.BeforeCheckout
    VSSHandler_BeforeCheckOut = True
    End Function

    Sub VSSHandler_AfterCheckOut(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String, ByVal Comment As String) Handles VSSHandler.AfterCheckout

    End Sub

    Function VSSHandler_BeforeRename(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal NewName As String) As Boolean Handles VSSHandler.BeforeRename
    VSSHandler_BeforeRename = True
    End Function

    Sub VSSHandler_AfterRename(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal OldName As String) Handles VSSHandler.AfterRename
    End Sub

    Function VSSHandler_BeforeUndoCheckOut(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String) As Boolean Handles VSSHandler.BeforeUndoCheckout
    VSSHandler_BeforeUndoCheckOut = True
    End Function

    Sub VSSHandler_AfterUndoCheckOut(ByVal Item As SourceSafeTypeLib.VSSItem, ByVal LocalSpec As String) Handles VSSHandler.AfterUndoCheckout
    End Sub

    Function VSSHandler_BeginCommand(ByVal unused As Integer) As Boolean Handles VSSHandler.BeginCommand
    VSSHandler_BeginCommand = True
    End Function

    Sub VSSHandler_EndCommand(ByVal unused As Integer) Handles VSSHandler.EndCommand
    End Sub

    Function VSSHandler_BeforeEvent(ByVal iEvent As Integer, ByVal Item As SourceSafeTypeLib.VSSItem, ByVal Str As String, ByVal Var As Object) As Boolean Handles VSSHandler.BeforeEvent
    VSSHandler_BeforeEvent = True
    End Function

    Sub VSSHandler_AfterEvent(ByVal iEvent As Integer, ByVal Item As SourceSafeTypeLib.VSSItem, ByVal Str As String, ByVal Var As Object) Handles VSSHandler.AfterEvent
    End Sub

    End Class
    </PRE>
  • Anonymous
    February 23, 2004
    Victor,
    One of my developers responded to this query offline with:
    "There was a bug affecting this area that we fixed recently - the plugin name was limited to 31 characters.
    Is it possible that the chosen name for the plugin was longer than 'VSSWormPlugin2.Plugin'? (this one has only 21 characters)

    Also, the plugin must be registered before using it, so we can co-create the COM object based on its GUID. Did the customer run regsvr32.exe on the dll before running SSExp to add the required registry entries under HKEY_CLASSES_ROOT?"

    Please advise. Korby
  • Anonymous
    February 27, 2004
    Has anyone successfully converted the VB5 code from the whitepaper to VB.Net. I am working on a project to automate our build process and this functionality would add great value for the process.

    I have attempted, and what I am seeing is that the Init sub is running fine, but no other function or sub seems to be called. Also the action in VSS (ie Checkout, Checkin, Add . . .) is not performed.

    My code is identical to that from Victor's post above with the exception I made the plugin name VSS.Plugin. Object is registered and I am able to debug and trap the successful call to the init sub.

    Any ideas?
  • Anonymous
    April 25, 2004
    Hi,
    Some of our developers also get "Error loading SourceSafe add-in: <name>".
    The length of the name is less than 31 bytes. (about 19 bytes).
    Any news about this one ?
    Thanks,
    Nir
  • Anonymous
    April 25, 2004
    Hi,
    Some of our developers also get "Error loading SourceSafe add-in: <name>".
    The length of the name is less than 31 bytes. (about 19 bytes).
    Any news about this one ?
    Thanks,
    Nir
  • Anonymous
    May 27, 2004
    Hi,

    Has anyone figured this out yet? I have written the code in C#, not a COM object and I'm wondering how to let SourceSafe know that the dll is there. I know in the whitepapers I have seen I have to create a file called ssaddin.ini and place <ProgID>=1 in this file but is this the same as with a .NET dll?

    Regards,
    Greg
  • Anonymous
    June 02, 2004
    Hi,

    I am displaying the VSS Source Safe Database in a tree structure on a C# Form. I can check items in and out but am having trouble Getting Latest Version. Has anyone any ideas ?

    Regards,
    Enda.
  • Anonymous
    June 03, 2004
    What version of VSS are you using and are you attempting a recursive Get or a simple one?
  • Anonymous
    June 21, 2004
    I am Using VSS version 6, i am using a Simple Get
  • Anonymous
    June 20, 2005
    Hey,

    I am implementing the VSS events as posted in micorsoft msdn web site, I added Project1.Class1=1 also.

    When I launch VSS it showed me the message, but immediatly it is crashing?

    Did any one can help me.....

    Thanks
  • Anonymous
    August 29, 2005
    Any body know how to add a project( folder ) to VSS database programatically?
  • Anonymous
    April 04, 2006
    digitalcameras-store@takoe.net
  • Anonymous
    August 25, 2006
    The comment has been removed
  • Anonymous
    August 25, 2006
    Thanks for the great tips about <a href="http://eteamz.active.com/carcredit/files/term-life-rates.html"">http://eteamz.active.com/carcredit/files/term-life-rates.html" title="term life rates">term life rates</a> and [URL=http://eteamz.active.com/carcredit/files/term-life-rates.html]term life rates[/URL]
  • Anonymous
    August 26, 2006
    Very many thanks for a good work. Nice and useful. Like it!
  • Anonymous
    September 03, 2006
    Very informative post about <a href="http://bestcarloan.250free.com/life-assurance.html"">http://bestcarloan.250free.com/life-assurance.html" title="life assurance">life assurance</a> and [URL=http://bestcarloan.250free.com/life-assurance.html]life assurance[/URL]
  • Anonymous
    September 04, 2006
    Thanks for the great tips about <a href="http://eteamz.active.com/bingogame/files/health-insurance-coverage.html"">http://eteamz.active.com/bingogame/files/health-insurance-coverage.html" title="health insurance coverage">health insurance coverage</a> and [URL=http://eteamz.active.com/bingogame/files/health-insurance-coverage.html]health insurance coverage[/URL]
  • Anonymous
    June 08, 2007
    The comment has been removed