Using Visual Source Safe to CheckIn a file using post build in Visual Studio

As easy as it looks in the documents.


ss Checkin TEST.C

Is not that simple using the post build environment supplied in Visual Studio.
Mostly the problem i came across is that ss does not provide a way to tell it which is the directory i want to check in the files from.
So If i run ss from C:\ but provide the SourceSafe directory of `$\Server\myTest\dir1\thefile.vb`  it goes ahead and say.. "The file was not checked out from this " C:\ " directory.
Fantastic, but then it fails to check it in because you are not in the projects folder that is mapped to source safe.So, jsut CD into the folder the file is in and this works like a dream... in command prompt
One way to over come this annoyance (because using CD to the dir you want in post build... well.. jsut does not CD to the dir.. it stays locked in your SS directory.. who knows why??)

So, create a CMD(batch) file that looks like this
@Echo off
set SSDIR=\\directory\of\your\ssinfofile
set SSUSER=username
set SSPWD=password
cd "C:\PROJECTS\SERVER\MySites\Site\My Project"
"C:\Program Files\Microsoft Visual Studio\COMMON\VSS\win32\ss.exe"  Checkin "$/Server/MySites/Site/My Project/AssemblyInfo.vb" -CBuildCheckin -I-Y
cd /
Pause

Running this from the post-build using

call c:\ss-checkin.cmd

I need to check in my assemblyinfo.vb file every time because i use the "Build Version Increment" plugin for VS, and if a few people work on the same project the build number will go out of synch an we would have no idea what is the real build number. So for each build, on any developers machine.. the file will check out via VS, the plugin will increment the BUILD, then post build will check the file back in.
Simple enough, but was not easy to figure out.
The bath will actually not pause, because the post-build environment prevents many applications from stopping the execution path.. ss.exe though, will stop to ask you a password if you remove `set SSPWD`, or confirm a checkin if you remove -I-Y

Comments