VS automation samples


I’ve been asked for suggestions for a list of VS automation samples that would help solve tricky tasks that I’ve observed users working on during usability studies. Just wanted to check if anybody has such a list of samples that they would like us to provide.


One example from a recent study that I can think of would be a sample to show how to automate migrating or copying a bunch of project settings from one project to a collection of other projects.


Any other suggestions?

Comments (6)

  1. Jeff Lewis says:

    CVS integration similar to http://ankhsvn.com/ would be a wonderful sample.

  2. Paul says:

    Copying VS options from one machine to another (ie, environmental options, debugger options, source control options, edit options, etc). This way when a new machine is built we don’t have to spend the next couple days ensuring we’ve got the options right, which we invariably miss.

  3. We have a little program that runs as a pre-build event to update the build version number in a couple source files — the build number is based on the date. I wanted to be able to update the version number in a setup project as well, but could not see how to automate that, since it causes a dialog box to pop up. Is such a thing possible?

  4. preEnvy says:

    Frank Hileman,

    Is there a way that little program could be shared? I am actually in the process to develop our own program that can do this but only to update the AssemblyFileVersionAttribute.

  5. Steven Clarke says:

    Frank – I sent your question to Craig Skibo (http://blogs.msdn.com/CraigSkibo). Here’s his reply:

    You could write code to select the setup project within the solution explorer. When the setup project is selected you can goto the property grid and get/set the version #. You select the item in the solution explorer by getting the UIHierarchy object with code such as this:

    dim uihier as UIHierarchy = DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Object

    uihier.GetItem("Setup1Setup1").Select(vsUISelectionTypeSelect) ‘Setup1Setup1 is SolutionNameProjectName

    Then you call off to DTE.SelectedItems.SelectionContainer.Item(1), which returns to you the IDispatch/System.Object of the item in the properties window.

  6. David Starr says:

    Alphabetize the using statements! PLEASE!