A How-To Guide for new VSS users. This document is based on Visual Source Safe 2005....
VISUAL SOURCE SAFE How-To Book CONTENTS INTRODUCTION..................................................................................................2 ABOUT ABOUT
THIS THE
DOCUMENT.................................................................................................................2 AUTHOR.....................................................................................................................2
INTRODUCTION..................................................................................................3 WHAT
IS
VISUAL SOURCE SAFE?......................................................................................................3
DEVELOPER’S GUIDE..........................................................................................3 Check if VSS working fine for a project.............................................................................3 Get Latest Code...............................................................................................................3 Check-Out a file for Editing..............................................................................................4 Check-In an edited file.....................................................................................................4 Cancel a Check-Out..........................................................................................................5 View Pending check-ins....................................................................................................6 View History/Check the revision details............................................................................6 TO SET UP AN EXISTING PROJECT IN DEVELOPER MACHINE............................................................................7 Check Out/Check In Policy..............................................................................................10 ADMINISTRATOR’S GUIDE.................................................................................10 INSTALLING VISUAL SOURCE SAFE....................................................................................................10 Visual Source Safe Administration..................................................................................12 Connect to an Existing Database...................................................................................13 User Management..........................................................................................................13 Archive/Restore Projects................................................................................................13 User Access Rights.........................................................................................................13 TO ADD A NEW PROJECT TO VSS....................................................................................................14 Microsoft Visual Source Safe Explorer............................................................................15
Visual Source Safe – How To
INTRODUCTION About this Document This document explains how to install and how to work with the Visual Source Safe, which is the most used Source Control.
About the Author Praveen.V.Nair, a Microsoft MVP Blog: http://blog.ninethsense.com/ Email:
[email protected]
Page 2
Visual Source Safe – How To
Source Control with Visual Source Safe (VSS)
Introduction A detailed guide about Visual Source Safe (VSS) is out of scope of this document and this guide is intended for the use of ordinary users who makes use of the VSS. If you make use of VSS with your Visual Studio, the chapter Developer’s Guide may be the only one you may need to use. If you feel yourself advanced, then go for Administrator’s Guide also.
What is Visual Source Safe? Microsoft Visual SourceSafe is the easiest source code management and version control system for development teams using Microsoft Visual Studio.NET. Developers can safely and easily manage source code, Web content, and any other type of file—all from the comfort and convenience of Visual Studio .NET.
Developer’s Guide Check if VSS working fine for a project Once you open the solution check the Solution Explorer whether you see icons with the items. If so, you can make sure VSS is working fine.
(lock)
Get Latest Code As you know we use VSS for collaborative editing of same source code between different developers. So it is very important to take latest code before you start development.
Page 3
Visual Source Safe – How To
Check-Out a file for Editing If you want to edit a file, there are two ways you can checkout a file: 1. Right-Click on the file (or project/solution) and click Check Out for Edit… 2. Or, just start editing the file and Visual Studio will automatically check-out for you. Once you checked-out a file, you can see a Solution Explorer for that file.
(tick) mark instead of lock in the
Check-In an edited file After you finished editing, you can check-in the file back to VSS by right clicking the file (or project/solution) and click on Check In…
Page 4
Visual Source Safe – How To
Once you clicked in Check In…, you will see a dialog asking you for confirmation.
IMPORTANT: Here, as a policy, you must type a small description about the change you did. For example, if you were fixing a bug then type the reference number of that bug along with a comment stating what change you did. Cancel a Check-Out You can always undo the changes by choosing Undo Checkout… from the Solution Explorer item menu.
Page 5
Visual Source Safe – How To
View Pending check-ins There may be situations you might check out many files in a big project and wanted to know which all files awaiting check-ins. You can use the View Pending checkins option. Once you select this, you can see a docked window with a list of objects which has not checked-in.
View History/Check the revision details If you wanted to know who edited a file (or project/solution) in past, just select the option View History. First you will be prompted a dialog like this, but you can simply click Ok if you do not want to filter the results.
Page 6
Visual Source Safe – How To
This is the view of the history.
Some useful features in this dialog window are: •
View – The selected version will be opened in a Notepad for reading
•
Details – This will show you general details including comments you provided while you checked-in the file
•
Diff – You can compare the selected file version with an existing file
To set up an existing project in Developer machine 1. Take Visual SourceSafe Explorer from: Start → Programs → Microsoft Visual SourceSafe → Microsoft Visual SourceSafe Page 7
Visual Source Safe – How To
2. Right click on the project you want to work on and click on ‘Set working folder’. (I used a sample – WindowsApplication1 as example)
Point your working folder to a path on your hard drive/disk.
3. Once you set the working folder, you need to get the latest version. This you can achieve from the right-click same menu -> Get Latest Version
Page 8
Visual Source Safe – How To
4. Click the ‘Recursive’ and ‘Build Tree’ checkboxes and click ok.
5. Now you can go directly to your working folder and open the solution (.sln) file Page 9
Visual Source Safe – How To
Check Out/Check In Policy As per our existing VSS setup, it is not possible for a developer to check-out a file or project which is already checked-out by another developer. File Restrictions Executable files (.exe) and configuration files (eg. Web.config) should not be checked in.
Administrator’s Guide Installing Visual Source Safe The steps involved in setting up the Visual Source Safe source control are explained below: Step 1: Install VSS from the setup CD. Step 2: Create a VSS Database for your project Every team (or product) will need a separate VSS database. This step is done using the VSS Admin software. When you install VSS software, it will install the Admin software as well as client software on your computer. Choose 'Visual SourceSafe Admin' from the start menu.
Page 10
Visual Source Safe – How To
When you launch the admin software, it will automatically connect to a default database called 'Microsoft Visual Studio'. After connecting to this default database using the VSS Admin tool, you will create a new database.
To create a new database, go to the 'Tools' menu and select 'Create Database'. You will be prompted to browse to a folder to create the new database. All you have to do is, select a folder and press 'OK'. This will create a new database. Even though this process created a new database for you, your VSS Admin tool is still connected to your default database called 'Microsoft Visual Studio'. To connect to your new VSS database, select the 'Users' menu and select 'Open SourceSafe Database'. This will show you a small dialog box with the list of previously connected databases. Since you have not yet connected to your new database, it will not be listed. So, press the 'Browse' button to search for the new database. Page 11
Visual Source Safe – How To Using the folder browser, you can navigate to the folder where you just created the new database. Inside the folder, you will see a file called 'SourceSafe.ini'. This is the database file you need to connect to. Select this file and press 'Open'. This will connect to the new database. Step 3: Create users After you connect to the new database, you will see the list of available users. There are 2 users created by default: 1. Admin 2. Guest Delete the Guest user. You do not want other people to connect to your secure VSS database. Also, change the password for admin user. By default, there is no password for this account. To change password, select 'Admin' user in the list and select 'Change Password' option from 'Users' menu. Now, select 'Add User' from 'Users' menu. This will show a dialog box where you can specify the user name and password.
Visual Source Safe Administration Click Start → Programs → Microsoft Visual Source Safe → Microsoft Visual Source Safe Administration By default you might see user list of an already connected VSS database.
Page 12
Visual Source Safe – How To
Connect to an Existing Database You can connect to an existing VSS database using menu File → Open Source Safe Database… User Management You can Add, Edit or Delete a user from Users menu. Also you can change the password of an existing user also from this menu. Archive/Restore Projects You can archive or restore projects using the menu File → Archive User Access Rights Rights in VSS specify which VSS users have access to a specific VSS project. There are four levels of user access rights in VSS: read, check out/check in, add/rename/delete, and destroy. The default level for new users of the database can be specified. • • • •
Read o General rights, allows you to access (Read) the file. Check out/Check In o To make a writable copy of the file, to be modified (Checkout). o To save the changes into the repository (Checkin) Add/Remove/Delete o To Add /Delete the files of folders in VSS database. Destroy o To destroy the projects from VSS.
Page 13
Visual Source Safe – How To
To add a new project to VSS •
Right click the solution explorer of the project, and click ‘Add solution to Source Control’.
•
Login to the VSS
•
Select location and give ok.
Page 14
Visual Source Safe – How To
Microsoft Visual Source Safe Explorer VSS Explorer is a useful tool for exploring the projects outside Visual Studio. You can consider this as an advanced administration tool. You can do almost every features available in Visual Studio as well as few additional also. Some of the features are: •
Check In/Check Out
•
View/Edit
•
Get Latest
•
Set Working Directory
•
Show History
•
Show Difference
•
Delete/Rename
•
Search
Page 15
Visual Source Safe – How To
Page 16