B
bryan
I have an C# windows app called Test.Exe. It is built with a reference to a
strongly named assembly called Base.dll, with a specific version and public
/ private key set. The version of Base.dll that Test.exe refers to is in the
same directory as Text.exe.
This application wants to load a strongly named assembly called Derived.dll
(in a separate directory), which was also built with a reference to a
(potentially different version of the) strongly named assembly of Base.dll.
The version of Base.DLL that Derived.dll refers to is located in the same
directory as Derived.DLL.
The application loads the Derived.dll assembly with a complete specification
(name, version and public key token) and uses
System.Reflection.Assembly.CreateInstance to create an instance of a class
from the assembly. If the versions of the Base.dll assembly are the same
(same build) then the instance is created successfully.
However, when the versions of Base.dll are different we get an error. The
assembly object is successfully loaded, but when used to call CreateInstance
of a type defined in Derived.dll, the
System.Reflection.Assembly.CreateInstance method returns null.
To test that the different version of Base.dll were the issue, we built
Test.EXE from the same version as Derived.dll was built from, and when that
version is executed, the system performs correctly.
What do we do to get implicitly included assemblies to use the specific
version of the assemblies that they refer to - and cause a load of a new
version if the one that is currently loaded is the correct name, but
incorrect version?
strongly named assembly called Base.dll, with a specific version and public
/ private key set. The version of Base.dll that Test.exe refers to is in the
same directory as Text.exe.
This application wants to load a strongly named assembly called Derived.dll
(in a separate directory), which was also built with a reference to a
(potentially different version of the) strongly named assembly of Base.dll.
The version of Base.DLL that Derived.dll refers to is located in the same
directory as Derived.DLL.
The application loads the Derived.dll assembly with a complete specification
(name, version and public key token) and uses
System.Reflection.Assembly.CreateInstance to create an instance of a class
from the assembly. If the versions of the Base.dll assembly are the same
(same build) then the instance is created successfully.
However, when the versions of Base.dll are different we get an error. The
assembly object is successfully loaded, but when used to call CreateInstance
of a type defined in Derived.dll, the
System.Reflection.Assembly.CreateInstance method returns null.
To test that the different version of Base.dll were the issue, we built
Test.EXE from the same version as Derived.dll was built from, and when that
version is executed, the system performs correctly.
What do we do to get implicitly included assemblies to use the specific
version of the assemblies that they refer to - and cause a load of a new
version if the one that is currently loaded is the correct name, but
incorrect version?