You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/how-to-specify-build-events-visual-basic.md
+26-8Lines changed: 26 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: 'Specify build events (Visual Basic)'
3
3
description: Explore how to use build events in Visual Basic to run scripts, macros, or other actions as a part of the compilation process.
4
-
ms.date: 11/04/2016
4
+
ms.date: 12/13/2024
5
5
ms.subservice: compile-build
6
6
ms.topic: how-to
7
7
helpviewer_keywords:
@@ -18,10 +18,26 @@ manager: mijacobs
18
18
19
19
Build events in Visual Basic can be used to run scripts, macros, or other actions as a part of the compilation process. Pre-build events occur before compilation; post-build events occur after compilation.
20
20
21
-
Build events are specified in the **Build Events** dialog box, available from the **Compile** page of the **Project Designer**.
21
+
:::moniker range=">=vs-2022"
22
22
23
-
> [!NOTE]
24
-
> Visual Basic Express does not support entry of build events. This is supported only in the full Visual Studio product.
23
+
## How to specify pre-build and post-build events
24
+
25
+
To view or change build events for a Visual Basic .NET Core or .NET 5 and later project, right-click the project node, and choose **Properties** (or press **Alt**+**Enter**), then go to **Compile** > **Events**. Enter the desired command line. The working directory is the output directory.
26
+
27
+
For .NET Framework projects, follow these steps:
28
+
29
+
1. With a project selected in **Solution Explorer**, on the **Project** menu, click **Properties**.
30
+
31
+
2. Click the **Compile** tab.
32
+
33
+
3. Click the **Build Events** button to open the **Build Events** dialog box.
34
+
35
+
4. Enter the command-line arguments for your pre-build or post-build action, and then click **OK**.
36
+
37
+
:::moniker-end
38
+
39
+
:::moniker range="<=vs-2019"
40
+
Build events are specified in the **Build Events** dialog box, available from the **Compile** page of the **Project Designer**.
25
41
26
42
## How to specify pre-build and post-build events
27
43
@@ -35,11 +51,13 @@ Build events are specified in the **Build Events** dialog box, available from th
35
51
36
52
4. Enter the command-line arguments for your pre-build or post-build action, and then click **OK**.
37
53
38
-
> [!NOTE]
39
-
> Add a `call` statement before all post-build commands that run *.bat* files. For example, `call C:\MyFile.bat` or `call C:\MyFile.bat call C:\MyFile2.bat`.
54
+
:::moniker-end
55
+
56
+
> [!NOTE]
57
+
> Add a `call` statement before all post-build commands that run *.bat* files. For example, `call C:\MyFile.bat` or `call C:\MyFile.bat call C:\MyFile2.bat`.
40
58
41
-
> [!NOTE]
42
-
> If your pre-build or post-build event does not complete successfully, you can terminate the build by having your event action exit with a code other than zero (0), which indicates a successful action.
59
+
> [!NOTE]
60
+
> If your pre-build or post-build event does not complete successfully, you can terminate the build by having your event action exit with a code other than zero (0), which indicates a successful action.
43
61
44
62
## Example: How to change manifest information using a post-build event
0 commit comments