Partager via


ResolveAssemblyReference Task

Determines all assemblies that depend on the specified assemblies, including second and nth-order dependencies.

Parameters

The following table describes the parameters of the ResolveAssemblyReference task.

Parameter Description

AppConfigFile

Optional String parameter.

Specifies an app.config to and extract bindingRedirect mappings from. If this parameter is specified, the AutoUnify parameter must be false.

Assemblies

Optional ITaskItem[] parameter.

Specifies the items to resolve into full paths and find dependencies. These items can either be simple or strong names.

Items passed to this parameter may have the following item metadata:

  • Private: Boolean value. If true, the item is copied locally.

  • HintPath: String value. Specifies the location of the file name to consider as a reference, used when {HintPathFromItem} is specified in the SearchPaths parameter.

  • SpecificVersion: Boolean value. If true, the exact fusion name specified in the Include attribute of the item must be matched. If false, any assembly with the same simple name will match. When absent, the task examines the value in Include attribute of the item. If the attribute is a simple name, it behaves as if this metadata had a value of false. If the attribute is a strong name, it behaves as if this metadata had a value of true.

  • ExecutableExtension: String value. When present, the resolved assembly must have this extension. When absent, .dll is considered first, followed by .exe, for each examined directory.

  • SubType: String value. Only items with empty SubType metadata will be considered. Items with non-empty SubType metadata will be ignored.

  • AssemblyFolderKey: String value. This metadata is supported for legacy assembly folder resolution. This key can have a syntax similar to:hklm\VendorFolderWhen set, only this particular assembly folder key will be used.

AssemblyFiles

Optional ITaskItem[] parameter.

Specifies a list of fully qualified assembly paths to find dependencies for.

Items passed to this parameter may have the following item metadata:

  • Private: an optional Boolean value. If true, the item is copied locally.

  • FusionName: optional String metadata. Specifies the simple or strong fusion name for this item. If this attribute is present it can save time since the assembly file won't need to be opened to get the fusion name.

AutoUnify

Optional Boolean parameter.

If true, the resulting dependency graph is automatically treated as if there were an App.Config file passed in to the AppConfigFile parameter. This virtual

App.Config file has a bindingRedirect entry for each conflicting set of assemblies such that the highest version assembly is chosen. A consequence of this is that there will never be a warning about conflicting assemblies because every conflict will have been resolved. Each distinct remapping will result in a high priority comment indicating the old and new versions and the fact that this was done automatically because AutoUnify was true.

If false, no assembly version remapping will occur automatically. When two versions of an assembly are present, there will be a warning. Each distinct conflict between different versions of the same assembly will result in a high priority comment. After all of these comments are displayed, there will be a single warning with a unique error code and text that reads “Found conflicts between different versions of reference and dependent assemblies”.

The default value is false.

CandidateAssemblyFiles

Optional String[] parameter.

Specifies a list of assemblies to use for the search and resolution process. Values passed to this parameter must be absolute file names or project-relative file names.

Assemblies in this list will be considered when the SearchPaths parameter contains {CandidateAssemblyFiles} as one of the paths to consider.

CopyLocalFiles

Optional ITaskItem[] read-only output parameter.

Returns every file in the ResolvedFiles, ResolvedDependencyFiles, RelatedFiles, SatelliteFiles, and ScatterFiles parameters that has CopyLocal item metadata with a value of true.

FilesWritten

Optional ITaskItem[] output parameter.

Contains the items written to disk.

FindDependencies

Optional Boolean parameter.

If true, dependencies will be found. Otherwise, only primary references are found. The default value is true.

FindRelatedFiles

Optional Boolean parameter.

If true, related files such as .pdb files and .xml files will be found. The default value is true.

FindSatellites

Optional Boolean parameter.

If true, satellite assemblies will be found. The default value is true.

RelatedFiles

Optional ITaskItem[] read-only output parameter.

Contains related files, such as XML and .pdb files with the same base name as a reference.

The items in this parameter contain the following item metadata:

  • Primary: Boolean value. If true, the item was passed in with the Assemblies parameter.

  • CopyLocal: Boolean value. Indicates whether the given reference should be copied to the output directory.

ResolvedDependencyFiles

Optional ITaskItem[] read-only output parameter.

Contains the nth order paths to dependencies. This parameter does not include first order primary references, which are contained in the ResolvedFiles parameter.

The items in this parameter contain the following item metadata:

  • CopyLocal: Boolean value. Indicates whether the given reference should be copied to the output directory.

  • FusionName: String value. Specifies the fusion name for this dependency.

  • ResolvedFrom: String value. Specifies the literal search path that this file was resolved from.

ResolvedFiles

Optional ITaskItem[] read-only output parameter.

Contains a list of all primary references resolved to full paths.

The items in this parameter contain the following item metadata:

  • CopyLocal: Boolean value. Indicates whether the given reference should be copied to the output directory.

  • FusionName: String value. Specifies the fusion name for this dependency.

  • ResolvedFrom: String value. Specifies the literal search path that this file was resolved from.

SatelliteFiles

Optional ITaskItem[] read-only output parameter.

Specifies any satellite files found. These will be CopyLocal=true if the reference or dependency that caused this item to exist is CopyLocal=true.

The items in this parameter contain the following item metadata:

  • CopyLocal: Boolean value. Indicates whether the given reference should be copied to the output directory. This value is true if the reference or dependency that caused this item to exist has a CopyLocal value of true.

  • DestinationSubDirectory: String value. Specifies the relative destination directory to copy this item to.

ScatterFiles

Optional ITaskItem[] read-only output parameter.

Contains the scatter files associated with one of the given assemblies.

The items in this parameter contain the following item metadata:

  • CopyLocal: Boolean value. Indicates whether the given reference should be copied to the output directory.

SearchPaths

Required String[] parameter.

Specifies the directories or special locations that are searched to find the files on disk that represent the assemblies. The order in which the search paths are listed is important. For each assembly, the list of paths is searched from left to right. When a file that represents the assembly is found, that search stops and the search for the next assembly starts.

This parameter can take the following types of values:

  • A directory path.

  • {HintPathFromItem}: Specifies that the task will examine the HintPath metadata of the base item.

  • {CandidateAssemblyFiles}: Specifies that the task will examine the files passed in through the CandidateAssemblyFiles parameter.

  • {Registry:_AssemblyFoldersBase_, _RuntimeVersion_, _AssemblyFoldersSuffix_}:

  • {AssemblyFolders}: Specifies the task will use the Visual Studio .NET 2003 finding-assemblies-from-registry scheme.

  • {GAC}: Specifies the task will search in the GAC.

  • {RawFileName}: Specifies the task will consider the Include value of the item to be an exact path and file name.

Silent

Optional Boolean parameter.

If true, no messages are logged. The default value is false.

StateFile

Optional String parameter.

Specifies al file name that indicates where to save the intermediate build state for this task.

SuggestedRedirects

Optional ITaskItem[] read-only output parameter.

Contains one item for every distinct conflicting assembly identity, regardless of the value of the AutoUnify parameter. This includes culture and PKT that was found that did not have a suitable bindingRedirect entry in the application configuration file.

Each item contains the following information:

  • Include attribute: Contains he full fusion name of the assembly family with a Version field value of 0.0.0.0

  • MaxVersion item metadata: Contains the maximum version number.

TargetFrameworkDirectories

Optional String[] parameter.

Specifies the path to the target framework directory. This parameter is required to determine the CopyLocal status for resulting items.

If this parameter is not specified, no resulting items will be have a CopyLocal value of true unless they explicitly have a Private metadata value of true on their source item.

TargetProcessorArchitecture

Optional String parameter.

The preferred target processor architecture. Used for resolving Global Assembly Cache (GAC) references.

This parameter can have a value of x86, IA64 or AMD64.

If this parameter is absent, the task first considers assemblies matching the architecture of the currently running process. If no assembly is found, the task considers assemblies in the GAC that have ProcessorArchitecture value of MSIL or no ProcessorArchitecture value.

Remarks

See Also

Concepts

MSBuild Tasks

Other Resources

MSBuild Task Reference