views:

541

answers:

2

Hey all,

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....

Thanks, Scott

+1  A: 

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

Arnshea
Thanks for the feedback. Yes I am basically going to be using EnvDTE to do this. My experience in limited with it and I couldn't find a good starting point. Chris answered with something I should have thought of which is to use a Macro to get a starting point.
Bomlin
A: 

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?

Chris Shaffer
Thanks, I should have thought of doing a Macro to get a starting point with the code. I used to do it all the time when scripting for Word and Excel.
Bomlin