|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with removing file.dll from applicationThe Application makes kod.cd file. After that I use: CodeDomProvider provider = new CSharpCodeProvider(); and so on - as NSDN shows - Ctr+C and Ctr+V -> working fine. After good compilation I call SYM object public class SYM : KOD { call some function from KOD; } Till now working perfect. But I can not do this again. When I try do this I have error that file kod.dll is used and I can not compile kod.cs to kod.dll again. Some how I have to free that file from current process. In order to do this I do: System.Diagnostics.Process.GetCurrentProcess().Modules[index of kod.dll].Dispose(); GC.SuppressFinalize(System.Diagnostics.Process.GetCurrentProcess().Modules[i ndex of kod.dll]); But it's not working. I need some help with this. Robert Janda Hello Robert,
You cannot unload a single .dll from an application domain, the whole application domain must be shut down (at least this is true for .NET 1.1). Therefore, create a secondary app. domain, compile and load the "kod" assembly into that domain, as well as load all code using the KOD class to that domain. When you need to recompile the base KOD class, shut down the whole domain, recompile kod.dll, re-create the app. domain and re-load all the necessary assemblies into the new app. domain. Show quote "Robert" <Rob***@discussions.microsoft.com> wrote in message news:1FF75E2F-BD08-45F8-A247-6D7257ABCB5F@microsoft.com... > Helo > > The Application makes kod.cd file. > After that I use: > CodeDomProvider provider = new CSharpCodeProvider(); > and so on - as NSDN shows - Ctr+C and Ctr+V -> working fine. > After good compilation I call SYM object > public class SYM : KOD > { > call some function from KOD; > } > Till now working perfect. > But I can not do this again. > When I try do this I have error that file kod.dll > is used and I can not compile kod.cs to kod.dll again. > Some how I have to free that file from current process. > In order to do this I do: > System.Diagnostics.Process.GetCurrentProcess().Modules[index of > kod.dll].Dispose(); > > GC.SuppressFinalize(System.Diagnostics.Process.GetCurrentProcess().Modules[i > ndex of kod.dll]); > > But it's not working. > > I need some help with this. > Robert Janda > Hi Dmytro
I resolved the problem. I compile the different dll file and I'm loading this dll usig assambly. Thanks. Show quote "Dmytro Lapshyn [MVP]" wrote: > Hello Robert, > > You cannot unload a single .dll from an application domain, the whole > application domain must be shut down (at least this is true for .NET 1.1). > Therefore, create a secondary app. domain, compile and load the "kod" > assembly into that domain, as well as load all code using the KOD class to > that domain. When you need to recompile the base KOD class, shut down the > whole domain, recompile kod.dll, re-create the app. domain and re-load all > the necessary assemblies into the new app. domain. > > "Robert" <Rob***@discussions.microsoft.com> wrote in message > news:1FF75E2F-BD08-45F8-A247-6D7257ABCB5F@microsoft.com... > > Helo > > > > The Application makes kod.cd file. > > After that I use: > > CodeDomProvider provider = new CSharpCodeProvider(); > > and so on - as NSDN shows - Ctr+C and Ctr+V -> working fine. > > After good compilation I call SYM object > > public class SYM : KOD > > { > > call some function from KOD; > > } > > Till now working perfect. > > But I can not do this again. > > When I try do this I have error that file kod.dll > > is used and I can not compile kod.cs to kod.dll again. > > Some how I have to free that file from current process. > > In order to do this I do: > > System.Diagnostics.Process.GetCurrentProcess().Modules[index of > > kod.dll].Dispose(); > > > > GC.SuppressFinalize(System.Diagnostics.Process.GetCurrentProcess().Modules[i > > ndex of kod.dll]); > > > > But it's not working. > > > > I need some help with this. > > Robert Janda > > > > > |
|||||||||||||||||||||||