Skip to content

Commit 01759ca

Browse files
CopilotBillWagner
andcommitted
Add -pathmap compiler option documentation for Visual Basic
Co-authored-by: BillWagner <[email protected]>
1 parent 5e70a90 commit 01759ca

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-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: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
description: "Learn more about: -pathmap"
3+
title: "-pathmap"
4+
ms.date: 12/16/2024
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+
>
35+
> Specifying `-pathmap` prevents breakpoints from working in local debug builds. Only set `-pathmap` for production or continuous integration builds.
36+
37+
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.
38+
39+
To specify multiple mapped source paths, separate each with a comma.
40+
41+
The compiler writes the source path into its output for the following reasons:
42+
43+
1. The source path is substituted for an argument when the <xref:System.Runtime.CompilerServices.CallerFilePathAttribute> is applied to an optional parameter.
44+
1. The source path is embedded in a PDB file.
45+
1. The path of the PDB file is embedded into a PE (portable executable) file.
46+
47+
|To set -pathmap in the Visual Studio integrated development environment|
48+
|---|
49+
|The **-pathmap** option is not available from within the Visual Studio development environment; it is available only when compiling from the command line.|
50+
51+
## Example
52+
53+
The following example compiles `Test.vb` and maps the source paths:
54+
55+
```console
56+
vbc -pathmap:C:\MyProject\=\BuildServer\,C:\Temp\=\BuildTemp\ Test.vb
57+
```
58+
59+
In this example, if a source file is located at `C:\MyProject\Program.vb`, it will appear in the output as `\BuildServer\Program.vb`.
60+
61+
## See also
62+
63+
- [Visual Basic Command-Line Compiler](index.md)
64+
- [Sample Compilation Command Lines](sample-compilation-command-lines.md)
65+
- <xref:System.Runtime.CompilerServices.CallerFilePathAttribute>

0 commit comments

Comments
 (0)