Hi
I've written a batch execution framework and in it I want (in some scenarios) to load an assembly from the GAC where there may be multiple versions but I just want to load the latest version.
Is this even possible?
TIA
Hi
I've written a batch execution framework and in it I want (in some scenarios) to load an assembly from the GAC where there may be multiple versions but I just want to load the latest version.
Is this even possible?
TIA
Linq to Gac can query the GAC. You can load assembly at runtime once you know what you want.
You should be able to use a publisher policy with a BindingRedirect. See this SO answer.
Assembly.LoadWithPartialName(string)
will do exactly what you want.
Thanks guys I'm trying to do the publisher policy bit at the moment as that would actually suit my needs perfectly. I don't seem to be able to add the policy assembly to the GAC though. It works ok on my dev machine, but won't install on the test server. Using the drag and drop through the shell extension I get:
"A module specified in the manifest of assembly 'policy.3.0.assemblyname.dll' could not be found"
Using gacutil I get "Failure adding assembly to the cache: Unknown Error"
My policy file looks like this:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="*assemblyname*"
publicKeyToken="7a19eec6f55e2f84"
culture="neutral" />
<bindingRedirect oldVersion="3.0.0.0"
newVersion="3.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Any ideas on this one??
cheers
Ben
This was answered here http://stackoverflow.com/questions/302239/error-adding-policy-file-to-gac#323207