Clean and Rebuild Macro problem

Posted on 2011-02-24
Last Modified: 2013-11-26
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()
    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 ?

Question by:fc_curling
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4

Author Comment

ID: 35000241
How come no one have responded yet ?

LVL 49

Expert Comment

ID: 35089496
automatically does a Clean before starting the build.

Author Comment

ID: 35111936

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.
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.


Author Comment

ID: 35111949
Full points available for a solution-
LVL 49

Expert Comment

ID: 35114622
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.
LVL 49

Accepted Solution

DanRollins earned 500 total points
ID: 35124441
This works...


Open in new window

Apparently the Build.CleanSolution command runs asynchronously.  By using the above, you can set the "wait for done" option and that prevents the error.

Author Closing Comment

ID: 35132426
Perfect Dan, just what I needed.

Do you have any links to any programming references for developing VS Macros and/or AddIns?
LVL 49

Expert Comment

ID: 35133805
No.  I just googled and tested.

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question