Recompile com object while excel is running

W

welyakim

I'm very new to this so please bear with me. I have created a c# class
wich is a COM object. I call methods of that object from VBA in excel.
It all works well. great. However, sometimes I want to make changes to
the class in C#. I find that I can't recompile the class in the visual
studio .net compiler becuase it says that the files are in use. In
order to compile I need to totaly shut down excel. Is there anyway I
can compile without shutting down excel? The macro is finished, why
does it still hold on to the dll?

On a possibly related note. The c# class makes a soap call to another
server (which is single threaded). The C# object is holding the
connection to the soap server and is blocking other requests. The
connection is not closed until Excel quits.

Please Help!
 
R

RB Smissaert

On the first one:
As long as Excel holds a reference to the dll you can't compile.
No idea about the second question.

RBS
 
R

RB Smissaert

This is code that is run from within VBA in an .xla add-in:

Sub RemoveReference(strReference As String)

Dim r As Reference

For Each r In ThisWorkbook.VBProject.References
If r.Name = strReference Then
ThisWorkbook.VBProject.References.Remove r
Exit Sub
End If
Next

End Sub

It will need some alterations if you want to run this from your C# IDE,
but this is the principle of it.


RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top