6.3.4. C# Module Configuration

After creating a C# system or creating modules, it might happen that some referenced assemblies cannot be resolved. The following screenshot shows how these errors are displayed in the Issues view.

Missing C# Assemblies
Figure 6.9. Missing C# Assemblies


Before the system can be parsed, the errors need to be resolved.

First, make sure that you are able to build the project locally on your system with your usual build system. If you are using MSBuild or xbuild, check the preferences for the build executor as described in Section 3.5.1, “C# Build Executor Configuration”. For those two executors, Sonargraph starts them as external process to extract all required info. This should be sufficient for most C# project types. If assemblies are missing, specify their paths on the installation profile level. See Section 3.5, “C# Configuration”.

Search paths for missing assemblies can be added using the menu entry "System""Configure C# Module(s)..." . Preprocessor symbols and external alias are read-only for imported modules.

C# Module Configuration
Figure 6.10. C# Module Configuration


Modules that contain unresolved references to assemblies are marked with "(!)". If a module is selected in the treeview on the left side, all referenced assemblies are shown with their paths on the right. Assemblies marked as "(virtual)" are referenced by the module indirectly (mscorlib.dll, System.dll, System.Core.dll): The reference is not present in the C# project file but is automatically added.

The lower part shows the paths that are used to locate referenced assemblies. The search path is constructed and searched in the following order:

  1. The directories defined on module level.

  2. The directories of referenced installation profiles on module level.

  3. The directories defined on system level.

  4. The directories of referenced installation profiles on system level.

If you have already defined installation profiles as described in Section 3.5, “C# Configuration” , you can add them as references by selecting "Profiles...". Or you can add individual directories via "Directories...".

You can also let Sonargraph search for assembly directories. Open the dialog via the button "Manage Assembly Directories..." and specify a directory where the search is started. Found directories can be assigned to either the system or module profiles by dragging them from left to right.

Locate Missing C# Assemblies
Figure 6.11. Locate Missing C# Assemblies


WARNING

Sonargraph does not support different versions of core assemblies (mscorlib, System, System.Core) to be used within the same software system. The easiest way to ensure that all modules use the same framework assemblies, assign the required installation profiles on system level. All modules will then use the same folders to look-up assemblies.

NOTE

Assembly dependencies are automatically determined and located by MSBuild or xbuild executors. If MSBuild or xbuild is configured as the build exector (see Section 3.5.1, “C# Build Executor Configuration”), missing assemblies need to be added on system or installation profile level (see Section 3.5, “C# Configuration”). Any additional assembly directories on module level are ignored.

NOTE

If your project does not reference external assemblies explicitly (e.g. for "Windows Store App" projects), references pointing to .NETCore libraries are automatically loaded from .NETFramework folder, to avoid clashes with assemblies that are referenced explicitly by other projects contained in the same system. This can lead to parser warnings, because some external types or methods might not be present in the .NETFramework assemblies.