Skip to content

Commit a2a82d8

Browse files
CopilotBillWagnergewarren
authored
Add documentation for Visual Basic -pathmap compiler option (#48177)
* Initial plan * Add -pathmap compiler option documentation for Visual Basic Co-authored-by: BillWagner <[email protected]> * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * Apply code review suggestions and add pathmap to Visual Basic TOC Co-authored-by: BillWagner <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BillWagner <[email protected]> Co-authored-by: Bill Wagner <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent 448f422 commit a2a82d8

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

docs/visual-basic/reference/command-line-compiler/compiler-options-listed-alphabetically.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The Visual Basic command-line compiler is provided as an alternative to compilin
5454
|[-optionstrict](optionstrict.md)|Enforces strict language semantics.|
5555
|[-out](out.md)|Specifies an output file.|
5656
|<code>-parallel[+&#124;-]</code>|Specifies whether to use concurrent build (+).|
57+
|[-pathmap](pathmap.md)|Specifies how to map physical paths to source path names output by the compiler.|
5758
|[-platform](platform.md)|Specifies the processor platform the compiler targets for the output file.|
5859
|`-preferreduilang`|Specify the preferred output language name.|
5960
|[-quiet](quiet.md)|Prevents the compiler from displaying code for syntax-related errors and warnings.|

docs/visual-basic/reference/command-line-compiler/compiler-options-listed-by-category.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ The Visual Basic command-line compiler is provided as an alternative to compilin
113113
|[-noconfig](noconfig.md)|Do not compile with Vbc.rsp|
114114
|[-nostdlib](nostdlib.md)|Causes the compiler not to reference the standard libraries.|
115115
|[-nowin32manifest](nowin32manifest.md)|Instructs the compiler not to embed any application manifest into the executable file.|
116+
|[-pathmap](pathmap.md)|Specifies how to map physical paths to source path names output by the compiler.|
116117
|[-platform](platform.md)|Specifies the processor platform the compiler targets for the output file.|
117118
|[-recurse](recurse.md)|Searches subdirectories for source files to compile.|
118119
|[-rootnamespace](rootnamespace.md)|Specifies a namespace for all type declarations.|
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
description: "Learn more about: -pathmap"
3+
title: "-pathmap"
4+
ms.date: 09/04/2025
5+
f1_keywords:
6+
- "pathmap"
7+
- "-pathmap"
8+
helpviewer_keywords:
9+
- "-pathmap compiler option [Visual Basic]"
10+
- "/pathmap compiler option [Visual Basic]"
11+
- "pathmap compiler option [Visual Basic]"
12+
ai-usage: ai-generated
13+
---
14+
# -pathmap
15+
16+
Specifies how to map physical paths to source path names output by the compiler.
17+
18+
## Syntax
19+
20+
```console
21+
-pathmap:path1=sourcePath1,path2=sourcePath2
22+
```
23+
24+
## Arguments
25+
26+
| Term | Definition |
27+
|----------------|-----------------------------------------------------------------------------|
28+
| `path1` | Required. The full path to the source files in the current environment. |
29+
| `sourcePath1` | Required. The source path substituted for `path1` in any output files. |
30+
31+
## Remarks
32+
33+
> [!NOTE]
34+
> Specifying `-pathmap` prevents breakpoints from working in local debug builds. Only set `-pathmap` for production or continuous integration builds.
35+
36+
The `-pathmap` compiler option specifies how to map physical paths to source path names output by the compiler. This option maps each physical path on the machine where the compiler runs to a corresponding path that should be written in the output files.
37+
38+
To specify multiple mapped source paths, separate each with a comma.
39+
40+
The compiler writes the source path into its output for the following reasons:
41+
42+
- The source path is substituted for an argument when the <xref:System.Runtime.CompilerServices.CallerFilePathAttribute> is applied to an optional parameter.
43+
- The source path is embedded in a PDB file.
44+
- The path of the PDB file is embedded into a PE (portable executable) file.
45+
46+
The `-pathmap` option is not available from within the Visual Studio development environment; it's available only when compiling from the command line.
47+
48+
## Example
49+
50+
The following example compiles `Test.vb` and maps the source paths:
51+
52+
```console
53+
vbc -pathmap:C:\MyProject\=\BuildServer\,C:\Temp\=\BuildTemp\ Test.vb
54+
```
55+
56+
In this example, if a source file is located at `C:\MyProject\Program.vb`, it will appear in the output as `\BuildServer\Program.vb`.
57+
58+
## See also
59+
60+
- [Visual Basic Command-Line Compiler](index.md)
61+
- [Sample Compilation Command Lines](sample-compilation-command-lines.md)
62+
- <xref:System.Runtime.CompilerServices.CallerFilePathAttribute>

docs/visual-basic/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,8 @@ items:
13791379
href: reference/command-line-compiler/optionstrict.md
13801380
- name: -out
13811381
href: reference/command-line-compiler/out.md
1382+
- name: -pathmap
1383+
href: reference/command-line-compiler/pathmap.md
13821384
- name: -platform
13831385
href: reference/command-line-compiler/platform.md
13841386
- name: -quiet

0 commit comments

Comments
 (0)