How did Microsoft create assemblies that have circular references?

I can only tell how the Mono Project does this. The theorem is quite simple, though it gives a code mess. They first compile System.Configuration.dll, without the part needing the reference to System.Xml.dll. After this, they compile System.Xml.dll the normal way. Now comes the magic. They recompile System.configuration.dll, with the part needing the reference to … Read more

Loading multiple versions of the same assembly

If both assemblies are compatible you can define in the app.exe.config or web.config file to always use the new version by declaring bindingRedirect . example <configuration> <runtime> <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″ appliesTo=”v1.0.3705″> <dependentAssembly> <assemblyIdentity name=”Regcode” publicKeyToken=”b03f5f7f11d50a3a” culture=””/> <bindingRedirect oldVersion=”0.0.0.0-65535.65535.65535.65535″ newVersion=”1.0.3300.0″/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> this config entry for dotnet 1.0 tells the asembly loader always to use … Read more

How do you loop through currently loaded assemblies?

Getting loaded assemblies for the current AppDomain: var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies(); Getting the assemblies referenced by another assembly: var referencedAssemblies = someAssembly.GetReferencedAssemblies(); Note that if assembly A references assembly B and assembly A is loaded, that does not imply that assembly B is also loaded. Assembly B will only be loaded if and when it … Read more

How to fix “Referenced assembly does not have a strong name” error

To avoid this error you could either: Load the assembly dynamically, or Sign the third-party assembly. You will find instructions on signing third-party assemblies in .NET-fu: Signing an Unsigned Assembly (Without Delay Signing). Signing Third-Party Assemblies The basic principle to sign a thirp-party is to Disassemble the assembly using ildasm.exe and save the intermediate language … Read more

Embedding assemblies inside another assembly

ILMerge does merge assemblies, which is nice, but sometimes not quite what you want. For example, when the assembly in question is a strongly-named assembly, and you don’t have the key for it, then you cannot do ILMerge without breaking that signature. Which means you have to deploy multiple assemblies. As an alternative to ilmerge, … Read more