G
Guest
Background:
I created a windows service with .NET 1.1 that is a shell that simply loads
assemblies and then loads a certain type there and calls a method. Those
dynamically loaded assmeblies meant to be upgardable. I wrote a code that
replaced assemly files with the new version and then windows service supposed
to load new version of the assembly and run it.
Problem:
While trying to implement this auto-upgrade feature, I ran into this
sequence of events that leads to a strange result:
- My windows service dynamically load an assembly "A" of version
1.0.1234.0000; run it for a while;
- Then assmebly "A" dll file gets replaced with assembly "B" file of version
1.0.5678.000.
- When service attempts to load assembly "B", for some reason returned
reference points to assembly "A".
I tried both
Assemly.Load(AssembyName.GetAssemblyName(newAssemblyPath))
and
Assembly.LoadFrom(newAssemblyPath)
with the same result - both return reference to "A" of version 1.0.1234.000.
Remarkably, AssembyName.GetAssemblyName(newAssemblyPath) returns correct
AssemblyName object - the one for the new assembly "B". Then feeding this
AssemblyName to Assemly.Load() still results in returned reference pointing
to assembly "A".
How to make sure Assemly.Load() and Assembly.LoadFrom() actually load the
assembly I specify?
Thank you,
I created a windows service with .NET 1.1 that is a shell that simply loads
assemblies and then loads a certain type there and calls a method. Those
dynamically loaded assmeblies meant to be upgardable. I wrote a code that
replaced assemly files with the new version and then windows service supposed
to load new version of the assembly and run it.
Problem:
While trying to implement this auto-upgrade feature, I ran into this
sequence of events that leads to a strange result:
- My windows service dynamically load an assembly "A" of version
1.0.1234.0000; run it for a while;
- Then assmebly "A" dll file gets replaced with assembly "B" file of version
1.0.5678.000.
- When service attempts to load assembly "B", for some reason returned
reference points to assembly "A".
I tried both
Assemly.Load(AssembyName.GetAssemblyName(newAssemblyPath))
and
Assembly.LoadFrom(newAssemblyPath)
with the same result - both return reference to "A" of version 1.0.1234.000.
Remarkably, AssembyName.GetAssemblyName(newAssemblyPath) returns correct
AssemblyName object - the one for the new assembly "B". Then feeding this
AssemblyName to Assemly.Load() still results in returned reference pointing
to assembly "A".
How to make sure Assemly.Load() and Assembly.LoadFrom() actually load the
assembly I specify?
Thank you,