views:

182

answers:

0

Hello everybody,

I am trying to optimize my work with VS by creating some macros. Currently I have the following macros:

Public Sub ReleaseBuild()
    DTE.ExecuteCommand("Build.SolutionConfigurations", "Release")
    DTE.ExecuteCommand("Build.RebuildSolution")
End Sub

Public Sub DebugBuild()
    DTE.ExecuteCommand("Build.SolutionConfigurations", "Debug")
    DTE.ExecuteCommand("Build.RebuildSolution")
End Sub

What I want is to clean the solution before actually rebuilding it. What I did was:

Public Sub ReleaseBuild()
    DTE.ExecuteCommand("Build.SolutionConfigurations", "Release")
    DTE.ExecuteCommand("Build.CleanSolution")
    DTE.ExecuteCommand("Build.RebuildSolution")
End Sub

Public Sub DebugBuild()
    DTE.ExecuteCommand("Build.SolutionConfigurations", "Debug")
    DTE.ExecuteCommand("Build.CleanSolution")
    DTE.ExecuteCommand("Build.RebuildSolution")
End Sub

But I get the error bellow:

alt text

I believe clean has to be done first before rebuilding. I know this can be done by running two separate macros, but I actually want to achieve it with one click.

Best Regards,

Kiril