4

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 http://img23.imageshack.us/img23/2667/errorcb.png

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

skaffman
  • 398,947
  • 96
  • 818
  • 769
Kiril Stanoev
  • 1,865
  • 2
  • 20
  • 33

1 Answers1

6

Rebuild does not CLEAN solution first

I know that from experience when working with a lot of projects and when I add param to method in one project and call that method from second project with implementation of additional parametat rebuild often show error considering number of parametaes in that method!

use

DTE.Solution.SolutionBuild.Clean(True)
DTE.Solution.SolutionBuild.Build(True)

not

DTE.ExecuteCommand("Build.CleanSolution")
DTE.ExecuteCommand("Build.RebuildSolution")
robert
  • 33,242
  • 8
  • 53
  • 74
Drakce
  • 61
  • 1
  • 2