troubleshooting Question

Load assembly to another domain in COM+ application

Avatar of dungla
dunglaFlag for Viet Nam asked on
C#
8 Comments1 Solution756 ViewsLast Modified:
Hi all,

Few day ago, I have a question about how to load assembly to another application domain. Now I met another issue.

My main application is running in COM+. Right now, already succeed to load dynamic compiled assembly to new application domain create within COM+ session. But the problem is: When I unload the domain and wish to delete the loaded assembly, but I can't.

(1) In the normal application (not COM+), I have succeed to compiled a C# file in runtime to assembly, then create new app domain -> load compiled assembly to new domain -> invoke method -> unload domain -> delete compiled assembly -> successfully.

(2) In COM+ application, I have succeed to compiled a C# file in runtime to assembly, then create new app domain -> load compiled assembly to new domain -> invoke method -> unload domain -> but cannot delete compiled assembly -> exception: the file was used by another process.

When running in debug mode, I've found the main difference is:
In (1) C# file store in D:\test.cs -> compile to test.dll assembly -> test.dll stored in D:\test.dll (same directory with C# file).

In (2) C# file store in D:\test.cs -> main application place in D:\MainApp -> compile to test.dll assembly -> test.dll stored in D:\MainApp\bin\Debug\test.dll and do not appear same as (1) D:\test.dll.

I think this is the reason why I cannot delete the assembly file.

Anyone please help me.
ASKER CERTIFIED SOLUTION
ptmcomp

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros