Skip to content

Commit 238e69b

Browse files
committed
docs(msbuild): clarify AssemblySearchPaths defaults
1 parent 50e5f7d commit 238e69b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

docs/msbuild/troubleshoot-assembly-references.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,29 @@ There were recent fixes made to `ResolveAssemblyReference` to alleviate the situ
150150
151151
There are two ways to customize the list of paths `ResolveAssemblyReference` searches in attempting to locate an assembly. To fully customize the list, the property `AssemblySearchPaths` can be set ahead of time. The order matters; if an assembly is in two locations, `ResolveAssemblyReference` stops after it finds it at the first location.
152152
153-
By default, there are ten locations `ResolveAssemblyReference` searches (four if you use the .NET SDK), and each can be disabled by setting the relevant flag to false:
153+
`AssemblySearchPaths` is a semicolon-delimited list. It supports a set of built-in placeholders (for example, `{HintPathFromItem}` and `{GAC}`) that expand to actual locations during resolution.
154+
155+
By default, non-SDK-style projects use the following search path order:
156+
157+
1. Candidate assembly files (`{CandidateAssemblyFiles}`)
158+
2. The `ReferencePath` property (`$(ReferencePath)`)
159+
3. Hint paths from `<Reference>` items (`{HintPathFromItem}`)
160+
4. The target framework directory (`{TargetFrameworkDirectory}`)
161+
5. Assembly folders from `AssemblyFolders.config` (`$(AssemblyFoldersConfigFileSearchPath)`)
162+
6. The registry (`{Registry:...}`)
163+
7. Legacy registered assembly folders (`{AssemblyFolders}`)
164+
8. The Global Assembly Cache (GAC) (`{GAC}`)
165+
9. Treat the `<Reference Include="...">` value as a real file name (`{RawFileName}`)
166+
10. The output directory (`$(OutDir)`)
167+
168+
SDK-style projects set a smaller default `AssemblySearchPaths` (excluding GAC/registry/output directory searches by default):
169+
170+
- `{CandidateAssemblyFiles}`
171+
- `{HintPathFromItem}`
172+
- `{TargetFrameworkDirectory}`
173+
- `{RawFileName}`
174+
175+
Each entry can be disabled by setting the relevant flag to `false`:
154176
155177
- Searching files from the current project is disabled by setting the `AssemblySearchPath_UseCandidateAssemblyFiles` property to false.
156178
- Searching the reference path property (from a `.user` file) is disabled by setting the `AssemblySearchPath_UseReferencePath` property to false.

0 commit comments

Comments
 (0)