Visual Studio: Clean and rebuild with one macro
macros, visual-studio
Solution
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")
Problem
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