How can I do a clean, build, & run with one click?

Viewed 68

Our WPF projects using Unity for DI do not seem to build correctly in Visual Studio 2019 unless we first do a solution clean, then a full solution build every time I want to run. I'd like to automate this, but it seems that VS2019 no longer has any sort of built-in macro support that I've found for doing this. Is there a way to do this natively? With an extension?

I've tried using the "Macros for Visual Studio" extension and recording these steps for playback, but that doesn't seem to get past the clean operation during playback. This is the macro I ended up with. I believe the issue is that it doesn't wait for one line to finish before the next starts, and I'm not sure how to make it wait in this extension, which has almost no documentation.

dte.ExecuteCommand("Build.CleanSolution");
dte.ExecuteCommand("Build.RebuildSolution");
dte.ExecuteCommand("Debug.Start");

I'm open to any solution that gets the job done.

0 Answers
Related