Bomlin
Bomlin

Reputation: 676

Visual Studio - Programmatically configure solution for source control

I am in the process of creating a Wizard to help my organization auto create a base project for all applications. The idea is that a programmer can enter a project name, a few other basics and the process will create some projects, add other project from source control, configure IIS, etc...

A lot of the work is done by simply using project templates and the IWizard interface for some of the more complicated operations. What I am trying to do is this, once all of the projects are auto created, I am creating a workspace and automatically moving all of the files under source control. I am also doing things like adding common projects, setting up some special settings in IIS, etc... The problem is that the solution file, although it is under source control, is not actually configured to use source control.

Anyone have an idea on how to programmatically configure a solution so that it is part of source control and ready to use? I've run into a brick wall and can't seem to get any further. BTW: In case a didn't make it clear, I'm essentially trying to do the same in code as right clicking on a project and selecting "Add Solution to Source Control."

Like I've said, I've got most of the issues solved. Just this last one is giving me fits...

The important facts: Windows XP VS 2008 TFS Using Microsoft.TeamFoundation objects....

Upvotes: 2

Views: 1828

Answers (2)

Chris Shaffer
Chris Shaffer

Reputation: 32575

I just did what you said while recording a Macro; Looks like:

    DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
    DTE.ActiveWindow.Object.GetItem("CLSTestSolution").Select(vsUISelectionType.vsUISelectionTypeSelect)
    DTE.ExecuteCommand("File.TfsAddSolutionToSourceControl")

Perhaps you can start there?

Upvotes: 1

Shea
Shea

Reputation: 11243

Can you handle this through the Visual Studio extensibility framework? EnvDTE basically provides access to anything you can do interactively...

Upvotes: 2

Related Questions