Home All Groups Group Topic Archive Search About

Determine projects in solution within VS2005 macro

Author
12 Jul 2006 3:31 PM
Oenone
I wish to create a macro (that runs within the BuildEvents_OnBuildDone
environment event IN VS2005) that loops through each of the projects in the
current solution and retrieves some details about each. At present I just
want to do something simple such as MsgBox each project's .vbproj
path/filename.

I've been unable so far to locate any reference material to help me figure
out how to do this.

Could anyone provide an example or a link to a good reference site that
would help me to achieve this?

Many thanks,

--

(O)enone

Author
12 Jul 2006 4:54 PM
Jared Parsons [MSFT]
Hello Oenone,

> I wish to create a macro (that runs within the BuildEvents_OnBuildDone
> environment event IN VS2005) that loops through each of the projects
> in the current solution and retrieves some details about each. At
> present I just want to do something simple such as MsgBox each
> project's .vbproj path/filename.
>
> I've been unable so far to locate any reference material to help me
> figure out how to do this.
>
> Could anyone provide an example or a link to a good reference site
> that would help me to achieve this?

Try this code out

Public Sub ShowFilePath(ByVal scope As EnvDTE.vsBuildScope, ByVal action
As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
        For Each project As EnvDTE.Project In DTE.Solution
            Dim fileName As String = project.Properties.Item("FileName").Value
            MessageBox.Show(fileName)
        Next
    End Sub

--
Jared Parsons [MSFT]
jared***@online.microsoft.com
All opinions are my own. All content is provided "AS IS" with no warranties,
and confers no rights.
Author
12 Jul 2006 6:40 PM
Oenone
Jared Parsons [MSFT] wrote:
> Try this code out

Perfect -- thanks very much.

--

(O)enone