How to create assemblies with cyclic dependency?

  • Thread starter Thread starter Alex Sedow
  • Start date Start date
A

Alex Sedow

For example, System.dll contains assembly reference to System.XML.dll,
System.XML.dll refers to System.dll. Some another open projects contain
cyclic assembly dependencies too.

How C# compiler may do that?

Alex.
 
That is probably because assemblies can be loaded only once. When load
System.XML it won't load Syste.dll if it is already loaded.
 
Alex,

You can not do this. It is not supported in C# or VB.NET (you might be
able to do it with managed extensions for C++, but I am not sure).

Not to mention the fact that it is a bit of a bad idea.

Hope this helps.
 
Alex,
How C# compiler may do that?

You can look at the Rotor build process
(http://sharedsourcecli.sscli.net) to see how System.dll and
System.Xml.dll are handled.

Basicly you can do like this

- Build assembly A, but use conditional compilation symbols to exclude
any code that uses assembly B.
- Build assembly B and reference assembly A.
- Rebuild assembly A to the same version, and this time include all
code, including parts that depend on assembly B.



Mattias
 
Thanks to all for answers!
You can look at the Rotor build process
(http://sharedsourcecli.sscli.net) to see how System.dll and
System.Xml.dll are handled.

Basicly you can do like this

- Build assembly A, but use conditional compilation symbols to exclude
any code that uses assembly B.
- Build assembly B and reference assembly A.
- Rebuild assembly A to the same version, and this time include all
code, including parts that depend on assembly B.



Mattias

I shall look at it.

Alex.
 
Back
Top