How do I Clean & Build my entire project via code?
-
I come across a problem in VS2005 which has been driving me crazy. Sporadically (and more often then not) when I attempt to open a form in Design view, I get an error page stating that a project dependency (another project that I added to the solution) could not be found. 98% of the time, my entire IDE crashes and I have to restart VS2005. The only way to fix this that I have found it to do the following steps: 1) Clean the Solution 2) Build Solution 3) Clean Project #1 4) Build Project #1 5) Clean Project #2 6) Build Project #2 Doing this manually several times a days is more then a little irritating. (Ultimately I would like to be able to fix whatever is causing this "lost dependency" problem) For now I would like to be able to do all the above using a macro, but I an not familier with the required Syntax. I worked out some of the code, but I am still at a loss on the command to Clean a specific Project. I been able to gather the folowing information....(Note this is just a small excerpt of my entire Macro Code)
' This Builds The Project
Dim objSolution As Solution = DTE.Solution
Dim objProject As Project 'Value Supplied By Other Routine
With objSolution.SolutionBuild
.BuildProject(.ActiveConfiguration.Name, objProject.UniqueName, True)
End WithQuestion is....how do I CLEAN the project before I build it? Help...!
________________________ Ben Santiago, MCP & A+ Programmer (SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS) Eastern Suffolk BOCES - Student Data Services Programming: Race between programmers building better idiot-proof apps, and the Universe producing better idiots. The Universe is winning. -Rich Cook
-
I come across a problem in VS2005 which has been driving me crazy. Sporadically (and more often then not) when I attempt to open a form in Design view, I get an error page stating that a project dependency (another project that I added to the solution) could not be found. 98% of the time, my entire IDE crashes and I have to restart VS2005. The only way to fix this that I have found it to do the following steps: 1) Clean the Solution 2) Build Solution 3) Clean Project #1 4) Build Project #1 5) Clean Project #2 6) Build Project #2 Doing this manually several times a days is more then a little irritating. (Ultimately I would like to be able to fix whatever is causing this "lost dependency" problem) For now I would like to be able to do all the above using a macro, but I an not familier with the required Syntax. I worked out some of the code, but I am still at a loss on the command to Clean a specific Project. I been able to gather the folowing information....(Note this is just a small excerpt of my entire Macro Code)
' This Builds The Project
Dim objSolution As Solution = DTE.Solution
Dim objProject As Project 'Value Supplied By Other Routine
With objSolution.SolutionBuild
.BuildProject(.ActiveConfiguration.Name, objProject.UniqueName, True)
End WithQuestion is....how do I CLEAN the project before I build it? Help...!
________________________ Ben Santiago, MCP & A+ Programmer (SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS) Eastern Suffolk BOCES - Student Data Services Programming: Race between programmers building better idiot-proof apps, and the Universe producing better idiots. The Universe is winning. -Rich Cook
Not sure how to do it in a macro, but you could do it in a batch file with ms build. Run the "Visual Studio 2005 command prompt" and type msbuild /? From the help messages:
Examples:
MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug
Hope that helps.
ChrisB