Microsoft KB Archive/317342

= How to perform common tasks in Visual SourceSafe =

Article ID: 317342

Article Last Modified on 12/11/2006

-

APPLIES TO


 * Microsoft Visual C# 2005 Express Edition
 * Microsoft Visual C# .NET 2002 Standard Edition, when used with:
 * Microsoft Visual SourceSafe 6.0C

-



This article was previously published under Q317342



IN THIS TASK

 * SUMMARY
 * Requirements
 * Visual SourceSafe common tasks
 * Add a solution to Visual SourceSafe
 * Check out a file under source control
 * Compare versions
 * Check in a file under source control
 * Complete code listing
 * Troubleshooting
 * REFERENCES



SUMMARY
This step-by-step article shows you how to add a new project to Visual SourceSafe, how to check in and check out files, and how to compare differences between different versions of the same file.

back to the top

Requirements
The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
 * Microsoft Visual Studio .NET or Microsoft Visual Studio 2005
 * Registered Visual SourceSafe account

This article assumes that you are familiar with the following topics:
 * Visual C#
 * Windows Forms
 * Microsoft Visual Studio .NET or Microsoft Visual Studio 2005

back to the top

Visual SourceSafe common tasks
The following steps will demonstrate how to perform several common tasks in Visual SourceSafe.:

Add a solution to Visual SourceSafe

 * 1) Start Visual Studio .NET or Visual Studio 2005.
 * 2) On the File menu, point to New, and then click Project.
 * 3) In the New Project dialogue box, click Visual C# Projects under Project Types in the left pane, and then click Windows Applications under Templates in the right pane. By default, Visual Studio .NET creates a solution with three files named App.ico, AssemblyInfo.cs, and Form1.cs.

Note In Visual Studio 2005, click Visual C# under Project Types.
 * 1) On the File menu, click Save All.
 * 2) On the File menu, point to Source Control, and then click Add Solution to Source Control. The Add to Source Safe dialog box appears.

Note The Visual SourceSafe Login dialog box may appear. Type your user name, password, and database, and then click OK. If you are unsure of this information, consult your Visual SourceSafe Administrator.
 * 1) In the Name text box, type VSS Test Project, and then click OK.
 * 2) A confirmation dialog box appears and asks you if you would like to create a new project named VSS Test Project. Click Yes.
 * 3) Start Visual SourceSafe. Notice that a project named VSS Test Project appears under the root folder ($/).

back to the top

Check out a file under source control

 * 1) Locate Form1.cs in Solution Explorer. Notice that a blue lock icon appears next to the file. This indicates that your copy of this file is read-only.
 * 2) In Solution Explorer, right-click Form1.cs, and then click Check Out. The Check Out dialog box appears.
 * 3) In the Comments text box, type Check out file for the first time.
 * 4) Click Check Out. Notice that the lock icon has changed to a check mark in Solution Explorer.
 * 5) Change the Text property of Form1.cs to VSS Test Form.
 * 6) Click on the File menu, and then click Save All.
 * 7) Start Visual SourceSafe. Notice that Form1.cs and Form1.resx appear checked out under the VSS Test Project folder.

back to the top

Compare versions

 * 1) Right-click Form1.cs in Solution Explorer, and then click Compare Versions. The Difference Options dialog box appears.
 * 2) Click OK. The Differences For File dialog box appears. Both versions of this file are displayed side-by-side. Deleted lines appear in blue, changed lines appear in red, and new lines appear in green.
 * 3) Press ALT+F4 to close the window.

back to the top

Check in a file under source control

 * 1) Right click Form1.cs in Solution Explorer and then click Check In. The Check In dialog box appears.
 * 2) In the Comments text box, type Changed text to VSS Test Form.
 * 3) Click Check In. Notice that the icon has changed back to a blue lock in Solution Explorer.
 * 4) Start Visual SourceSafe. Notice that Form1.cs and Form1.resx no longer appear checked out under the VSS Test Project folder.

back to the top

Complete code listing
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data;

namespace WindowsApplication2 {   ///     /// Summary description for Form1. ///    public class Form1 : System.Windows.Forms.Form {       ///         /// Required designer variable. ///        private System.ComponentModel.Container components = null;

public Form1 {           //             // Required for Windows Form Designer support //            InitializeComponent;

//            // TODO: Add any constructor code after InitializeComponent call //        }

///        /// Clean up any resources being used. ///        protected override void Dispose( bool disposing ) {           if( disposing ) {               if (components != null) {                   components.Dispose; }           }            base.Dispose( disposing ); }

#region Windows Form Designer generated code ///        /// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///        private void InitializeComponent {           //             // Form1 //            this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(292, 268); this.Name = &quot;Form1&quot;; this.Text = &quot;VSS Test Form&quot;;

}       #endregion

///        /// The main entry point for the application. ///        [STAThread] static void Main {           Application.Run(new Form1); }   } } Note The code should be changed in Visual Studio 2005. By default, when you create a Windows Forms project, Visual C# adds one form to the project. The form is named Form1. The two files that represent the form are named the Form1.cs file and the Form1.designer.cs file. You write your code in the Form1.cs file. The Form1.designer.cs file is where the Windows Forms Designer writes the code that implements all the actions that you performed by dragging and dropping controls from the Toolbox. For more information about the Windows Forms Designer in Visual C# 2005, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms173077.aspx

back to the top

Troubleshooting
You need a Visual SourceSafe account to complete these tasks. If you do not have an account, consult your Visual SourceSafe Administrator.

back to the top

