Skip to content
CLR has a feature to forward type implementation to another assembly
C# Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
MyLibrary
TypeForwardingTest
keys
v2
.gitattributes
.gitignore
TypeForwardingTest.sln
make_v2.bat
readme.md

readme.md

.Net Type Forwarding Example

TypeForwardingTest application references BlackClass and RedClass from MyLibrary.dll. In the next version, the library is split into two parts: BlackLibrary.dll and RedLibrary.dll: those are in the "v2" folder.

However, we can still keep existing callers compatible by creating a shim version of Library.dll that forwards BlackClass and RedClass to the new assemblies.

Run make_v2.bat to copy v2 binaries to the bin folder, and observe that the original TypeForwardingTest.exe runs just fine, invoking new versions of the classes from new assemblies.

Note that BlackLibrary.dll and RedLibrary.dll are signed with a different public key, and it does not cause any issues. MyLibrary.dll, however, has to be signed with the same key in all versions, or binary compatibility will be broken.

See also:

You can’t perform that action at this time.