SmartAssembly 6

How SmartAssembly searches for dependencies

To locate and load a dependency, SmartAssembly searches for the dependency in the following locations, in this order:

  1. The GAC (Global Assembly Cache). The dependency must have an assembly name which includes the same version number and public key token.
  2. The framework folder and associated folders (for SDKs, Silverlight, XNA, etc.).
  3. The main assembly folder for a dependency with a similar assembly name (even if the version and/or public key token are different).

If your dependency is not found, or if the wrong version of it is found, you can override the normal behavior by manually editing the SmartAssembly project file (*.saproj) in an XML editor. To do this, add the MandatoryPath attribute to the <Assembly> tag, as in the example below:

<Assembly AssemblyName="dependency_assembly_name" MandatoryPath="C:\path\DependencyToUse.dll">

SmartAssembly will always use the dependency found at this location.

If the dependency is not valid (for example, the file is not found, or the assembly has a different assembly name), SmartAssembly does not process your assembly and reports an error.


Removing folders from the dependency search

In rare cases, you may wish to ignore a folder when SmartAssembly searches for a dependency. An example is when you do not have permission to access the folder, and so you cannot check which versions of the dependency are in the folder.

To remove a folder from the dependency search:

  1. In an XML editor, open the SmartAssembly.settings file.
    • In Windows Vista and later, this is stored in %ProgramData%\Red Gate\SmartAssembly\ 
    • In Windows XP, this is stored in %ProgramFiles%\Red Gate\SmartAssembly 6\
  2. Find the <DependenciesSearchPaths> node.
  3. In the <DependenciesSearchPaths>, each search path is contained in a <SearchPath>node.
  4. Delete the search path that you do not want to look in when SmartAssembly searches for dependencies.

Didn't find what you were looking for?