Denaes Posted August 1, 2006 Posted August 1, 2006 (edited) error MSB3021: Unable to copy file "obj\Debug\Common.DataAccess.dll" to "bin\Debug\Common.DataAccess.dll". The process cannot access the file 'bin\Debug\Common.DataAccess.dll' because it is being used by another process. Done building project "Common.DataAccess.vbproj" -- FAILED. I call a Macro that loads the "bin\Debug\Common.DataAccess.dll" file into an Assembly instance, then I use getTypes() to run through all the types and I copy some names off into a collection for use in the Macro. At this point, I set the assembly instance = to nothing. There isn't any Dispose or ReleaseAssembly. But when I attempt to rebuild the "Common.DataAccess.dll", I get the error that it's in use. Looking at various pages, MS's example doesn't even set the assembly to nothing and most of the examples only set the instance to nothing. None of it's methods/properties seem like they would help. So how can I force this to release it's hold on the file? Here is the code I'm roughly using: Dim assData As Reflection.Assembly assData = Assembly.LoadFrom(Path) For Each typeData As Type In assData.GetTypes If typeData.FullName Like "TableAdapter" Then ' Code to copy text from the type End If Next assData = Nothing I load it, I get it's types and then set it to nothing. Edited August 1, 2006 by Denaes Quote
mskeel Posted August 1, 2006 Posted August 1, 2006 This looks related. http://www.xtremedotnettalk.com/showthread.php?t=95867 Quote
Denaes Posted August 2, 2006 Author Posted August 2, 2006 Marble_Eater suggested using the AppDomain as well in another thread. But... there is always a but. I'm doing this at design time, not runtime. An Assembly can only be loaded into one AppDomain at a time and because the Assembly I'm loading is loaded into the projects (or solutions, I'm not sure) AppDomain, I can't load it into a new AppDomain. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.