Link to home
Start Free TrialLog in
Avatar of fc_curling
fc_curlingFlag for Denmark

asked on

Clean and Rebuild Macro problem

I'm trying to create a macro that will perform a Clean Solution ad then a Rebuild Solution.
When recording a macro doing so it creates:

Public Module RecordingModule

    Sub TemporaryMacro()
        DTE.ExecuteCommand("Build.CleanSolution")
        DTE.ExecuteCommand("Build.RebuildSolution")
    End Sub
End Module

Open in new window


When I run this, I get the following error (after cleaning the solution)

An exception of type 'System.Runtime.InteropServices.COMException' occurred in VBAssembly but was not handled in user code

Additional information: Et kald til en COM-komponent returnerede fejlen HRESULT E_FAIL.

I tried inserting a Threading.Thread.Sleep() but that didn't help.

Any suggestions ?



Avatar of fc_curling
fc_curling
Flag of Denmark image

ASKER

How come no one have responded yet ?

Avatar of DanRollins
Build.RebuildSolution
automatically does a Clean before starting the build.
http://www.codekicks.com/2009/06/difference-between-build-solution-and.html
@DanRollins

No it doesn't.
Rebuild forces a rebuild on all projects in the solution, it doesn't make a cleanup of the bin folder first.
Full points available for a solution-
I don't know why the error occurs, but what I said stands.  
Try it.  Note that the timestamp changes on the DLLs and other files in the BIN folder that are normally deleted by Clean.  They (all of them) are rebuilt during the Rebuild process.
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect Dan, just what I needed.

Do you have any links to any programming references for developing VS Macros and/or AddIns?
No.  I just googled and tested.