Perforce Public Knowledge Base - Create New VS 2010 Project in Perforce using P4VS
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Company Partners Careers Contact Free Trials
Menu Search
Perforce
Reset Search
 

 

Article

Create New VS 2010 Project in Perforce using P4VS

« Go Back

Information

 
Problem

How do I create a new Visual Studio 2010 project and add it to Perforce using the P4VS plugin integration?

Solution

Here are steps to create a new Visual Studio 2010 project and add it to Perforce using the P4VS plugin integration. The steps also include creating a Perforce client workspace for the project.

NOTE: Confirm that P4VS is the current source control plug-in in Visual Studio 2010.

  • In Visual Studio 2010, go to the menu Tools -> Options
  • Under Options go to Source Control -> Plug-in Selection
  • Make sure you see selected in the drop-down box: P4VS - Perforce Plugin for Visual Studio

 

EXAMPLE

This example is done using a project named vs10genapp.

  1. Open the Visual Studio 2010 application.
  • Create a new project and add it to source control.
    • In Visual Studio 2010 go to menu File -> New Project
    • In the New Project dialog, select Visual C++ -> General -> Empty Project
    • Name: vs10genapp
    • Location: C:\myspaces\
    • Solution Name: (fills in with the Name entered)
    • Create directory for solution (checked)
    • Add to Source Control (checked)
    • Click the OK button.
  • The P4 Open Connection dialog appears. For Server, fill in the Perforce server name and port. For User, fill in the Perforce user name. For Workspace, click the New button.
  • In the New Workspace dialog enter the name. For example, vs10genapp. Click the OK button.
  • In the New Workspace dialog, set up the Root and View fields.
    Root:   C:\myspaces\vs10genapp
    
    View:
            //scc/... //vs10genapp/...
    
    
    Click the SAVE button.
  • Back at the P4 Open Connection dialog, you see the new workspace filled in under the Workspace field. Click the OK button.
  • A P4VS dialog opens with text:
      Adding new solution's files to the Perforce depot
    
    
    and gives option to select the default or new pending changelist. (Selecting New from the drop-down enables the Changelist description edit box.)

    Click the OK button.
  • Now back in Visual Studio, look in Solution Explorer and notice the red plus-marks next to the Solution and project folders, indicating these are checked out for add in Perforce.

    In Visual Studio, go to menu View -> Pending Changelists, if you want to make the dialog visible.

    Notice also on the command line, that Perforce reports the VS project as being checked out:
    $ p4 opened -u testguy
    //scc/vs10genapp.sln#1 - add default change (text) by testguy@vs10genapp
    //scc/vs10genapp/vs10genapp.vcxproj#1 - add default change (text) by testguy@vs10genapp
    //scc/vs10genapp/vs10genapp.vcxproj.filters#1 - add default change (text) by testguy@vs10genapp
    
  • Check in and submit your project from within Visual Studio.
    You can do this from the File menu:
     1. Click menu File -> Perforce -> Submit
     2. A Submit Files dialog appears. Write a changelist description and click the Submit button.
    
    
    or submit using the context menu:
     1. In Solution Explorer, select the project, right-click and select Submit.
     2. A Submit Files dialog appears. Write a changelist description and click the Submit button. 
  • Notice now in Solution Explorer that the project will have either a lock icon or a green dot icon next to it. Mouse over the icon and you will see the confirming text:
      #1/1  Checked In
    
 

Now the Visual Studio project files are added to Perforce using the P4VS plugin integration.

You can check to see that the Visual Studio project files were added to Perforce. The example below uses the 'p4 files' command from the command line.
 

EXAMPLE

$ p4 files //scc/vs10genapp/...
//scc/vs10genapp/vs10genapp.vcxproj#1 - add change 1121 (text)
//scc/vs10genapp/vs10genapp.vcxproj.filters#1 - add change 1121 (text)

NOTE: The example above was created using the following versions and components: (Help -> About Microsoft Visual Studio)

  • Microsoft Visual Studio 2010
    Version 10.0.30319.1 RTMRel
    Microsoft .NET Framework
    Version 4.0.30319 RTMRel
    Installed Version: Professional
  • Microsoft Office Developer Tools 01018-532-2002102-70964
    Microsoft Visual Basic 2010 01018-532-2002102-70964
    Microsoft Visual C# 2010 01018-532-2002102-70964
    Microsoft Visual C++ 2010 01018-532-2002102-70964
    Microsoft Visual F# 2010 01018-532-2002102-70964
    Microsoft Visual Studio 2010 Team Explorer 01018-532-2002102-70964
    Microsoft Visual Web Developer 2010 01018-532-2002102-70964
    Crystal Reports Templates for Microsoft Visual Studio 2010
    Microsoft Visual Studio 2010 SharePoint Developer Tools 10.0.30319
  • P4VS - Perforce Plugin for Visual Studio 2012.1.46.3760

There is also a P4VS User's Guide as an available reference.

 

 

Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255