[MonoDevelop] Assembly reference resolution in MD

Lluis Sanchez Gual lluis at novell.com
Thu Feb 5 13:18:02 EST 2009


Hi,

I've been thinking about how to fix bug
https://bugzilla.novell.com/show_bug.cgi?id=352440 and I'd like some
feedback about it.

The problem is that when an assembly reference is added to a project, MD
stores the name and the version of the assembly only, and stores no
information about the package that provides it. When loading the
project, MD determines the package for each assembly reference by
checking which one includes that specific assembly and version. The
problem arise when there are several packages providing the same exact
assembly version.

The assembly list in the Project References dialog is built by scanning
the .pc files installed by packages. There are basically two types of
Mono packages which require a .pc file.

     1. Libraries which are installed in the GAC. They provide a .pc
        file so that applications can link to them.
     2. Applications which don't install assemblies in the GAC, but
        which may be extended by add-ins, so they need to publish their
        assemblies in a .pc file.

Packages of the first type are the most common case and they are not a
problem because there can't be two packages providing the same GACed
assembly.

Packages of the second type are less common but more problematic. For
example, there can be two applications with private copies of the same
version of Mono.Addins. When loading a project, MD wouldn't know which
one to pick.

The easiest solution for this problem is to always store the package
name together with the assembly name in the project file. The problem
with this solution is that it adds a lot of noise to project files which
in many cases is not necessary (storing that the gtk-sharp assembly
comes from the gtk-sharp package is redundant and unnecessary).

A more refined solution would be to store the package name only for
libraries which are not installed on the GAC. However, there is no
reliable way to know if a package is a 'GAC' package or an 'Application'
package.

So my solution would be to annotate this information in the .pc file.
Application packages would include in its .pc file a special variable
Private=true, and MD would always store the package name when adding a
reference to an assembly of such package. Does this requirement sound
reasonable? Any other ideas?

Lluis.




More information about the Monodevelop-list mailing list