Skip to content

Commit 47867f7

Browse files
authored
Fix #49457 – Update VB build instructions to prefer dotnet build over vbc.exe (#49518)
* Add 'See also' link to dotnet build in VB compiler doc * Fix #49457 - Update VB build instructions to prefer dotnet build over vbc.exe * Fix link path typo in VB compiler doc * Fix link path for dotnet build in VB compiler doc * Fix relative link path for dotnet build reference * Fix markdown code block formatting to resolve OPS warning * Fix markdown code block formatting to resolve OPS warning * Fix markdown code block formatting to resolve OPS warning * Fix markdown code block formatting to resolve OPS warning * Fixed markdown formatting and duplicate code block issue in VB command-line compiler doc * Fixed markdown formatting and duplicate code block issue in VB command-line compiler doc * Move tip to top and add styled link to dotnet build * Move tip to top and add styled link to dotnet build * Remove extra blank lines from VB compiler doc
1 parent 6982979 commit 47867f7

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command

Whitespace-only changes.

docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ helpviewer_keywords:
99
- "command line [Visual Basic], arguments"
1010
ms.assetid: 0fd9a8f6-f34e-4c35-a49d-9b9bbd8da4a9
1111
---
12-
# How to: Invoke the Command-Line Compiler (Visual Basic)
12+
# How to Invoke the Command-Line Compiler
13+
14+
[!TIP]
15+
For modern .NET projects, use the [`dotnet build`](../../../core/tools/dotnet-build.md) command to compile Visual Basic source files.
16+
The `vbc.exe` command-line compiler is only used for older .NET Framework projects.
1317

1418
You can invoke the command-line compiler by typing the name of its executable file into the command line, also known as the MS-DOS prompt. If you compile from the default Windows Command Prompt, you must type the fully qualified path to the executable file. To override this default behavior, you can either use the Developer Command Prompt for Visual Studio, or modify the PATH environment variable. Both allow you to compile from any directory by simply typing the compiler name.
1519

@@ -19,13 +23,18 @@ You can invoke the command-line compiler by typing the name of its executable fi
1923

2024
1. Open the Visual Studio Tools program folder within the Microsoft Visual Studio program group.
2125

22-
2. You can use the Developer Command Prompt for Visual Studio to access the compiler from any directory on your machine, if Visual Studio is installed.
26+
2. You can use the **Developer Command Prompt for Visual Studio** to access the compiler from any directory on your machine, if Visual Studio is installed.
27+
28+
3. Open the **Developer Command Prompt for Visual Studio**.
2329

24-
3. Invoke the Developer Command Prompt for Visual Studio.
30+
4. At the command line, type `vbc.exe <sourceFileName>` and then press **Enter**.
2531

26-
4. At the command line, type `vbc.exe` *sourceFileName* and then press ENTER.
32+
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type:
2733

28-
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type `cd SourceFiles` to change to that directory. If the directory contained a source file named `Source.vb`, you could compile it by typing `vbc.exe Source.vb`.
34+
```cmd
35+
cd SourceFiles
36+
vbc.exe Source.vb
37+
```
2938

3039
## To set the PATH environment variable to the compiler for the Windows Command Prompt
3140

@@ -43,17 +52,23 @@ You can invoke the command-line compiler by typing the name of its executable fi
4352

4453
6. Click **OK** to confirm your edits and close the dialog boxes.
4554

46-
After you change the PATH environment variable, you can run the Visual Basic compiler at the Windows Command Prompt from any directory on the computer.
55+
After you change the PATH environment variable, you can run the Visual Basic compiler at the Windows Command Prompt from any directory on the computer.
4756

4857
## To invoke the compiler using the Windows Command Prompt
4958

5059
1. From the **Start** menu, click on the **Accessories** folder, and then open the **Windows Command Prompt**.
5160

52-
2. At the command line, type `vbc.exe`*sourceFileName* and then press ENTER.
61+
2. At the command line, type `vbc.exe <sourceFileName>` and then press **Enter**.
62+
63+
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type:
5364

54-
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type `cd SourceFiles` to change to that directory. If the directory contained a source file named `Source.vb`, you could compile it by typing `vbc.exe Source.vb`.
65+
```cmd
66+
cd SourceFiles
67+
vbc.exe Source.vb
68+
```
5569

5670
## See also
5771

5872
- [Visual Basic Command-Line Compiler](index.md)
5973
- [Conditional Compilation](../../programming-guide/program-structure/conditional-compilation.md)
74+
- [dotnet build](../../../core/tools/dotnet-build.md) — for modern .NET SDK usage

0 commit comments

Comments
 (0)