| Michael Engelmann 2004-09-29, 8:09 pm |
| Hi
I have 2 questions and no answers....
1.
How can I get the Value of the $TargetName Macro (from the
project-properties) in the DTE.Object?
DTE.Solution.Solutionbuild.??????
2.
I want do build some Solutionions one after the other. Ok, I can make
a big Solution an insert all Solutions to build in it. But this way is
<censored>.
I want to open the first solution, build them, if build is ok, close,
open a new solution, and so on. So I wrote a macro to do this:
Imports EnvDTE
Imports System.Diagnostics
Public Module ScriptTest
Dim WithEvents bldevents As BuildEvents
Dim WithEvents solevents As SolutionEvents
Dim applicationObject As EnvDTE.DTE
Sub TestModal()
DTE.ExecuteCommand("View.ResourceView")
DTE.ExecuteCommand("View.SolutionExplorer")
DTE.ExecuteCommand("View.Output")
DTE.Solution.Open("FirstSolution.sln")
SetBuildEvent()
SetCloseEvent()
ScriptSetConfiguration("Release")
DTE.Solution.SolutionBuild.Build()
End Sub
private Sub NextSolution()
DTE.Solution.Open("SecondSolution.sln")
SetBuildEvent()
SetCloseEvent()
ScriptSetConfiguration("Release")
DTE.Solution.SolutionBuild.Build()
End Sub
Private Sub solevents_AfterClosing() Handles solevents.AfterClosing
NextSolution()
End Sub
Private Sub bldevents_OnBuildDone(ByVal Scope As
EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles
bldevents.OnBuildDone
DTE.Solution.Close()
End Sub
Private Sub ScriptSetConfiguration(ByVal ActiveConfig As String)
Dim sb As SolutionBuild
Dim config As SolutionConfiguration
Dim context As SolutionContext
sb = DTE.Solution.SolutionBuild
config = sb.ActiveConfiguration
For Each context In config.SolutionContexts
context.ConfigurationName = ActiveConfig
context.ShouldBuild = True
Next
DTE.Windows.Item(Constants.vsWindowKindOutput).Activate()
End Sub
Private Sub SetBuildEvent()
applicationObject = CType(Application, EnvDTE.DTE)
bldevents = CType(applicationObject.Events.BuildEvents,
EnvDTE.BuildEvents)
End Sub
Private Sub SetCloseEvent()
applicationObject = CType(Application, EnvDTE.DTE)
solevents = CType(applicationObject.Events.SolutionEvents,
EnvDTE.SolutionEvents)
End Sub
End Module
It works fine.......
for the first solution. If it has to open the Second Solution, the IDE
opens something, but not the whole SecondSolution (the menu
File->CloseSolution is grayed), only the Project is opend.
Is it not possible to open a new Solution, after closing a solution,
using Events?
I use Framework 1.1, Development Enviroment 2003
Michael
|