c# – In Visual Studio 2022, is there a way to output two executable from a single project


You can output multiple executables from a single build and you can save them to different folders and give them different file names. You can create extra configuration in addition to Debug and Release configurations that get created automatically for most projects. For each configuration you can set a different value of variables (in your case, PROGRAM1 or PROGRAM2). Once you create your configurations and set appropriate values of your variables for each configuration, you can build multiple configurations with one build command by using Batch Build feature of the Visual Studio.

Create a build configuration

To create a build configuration for a project:

  1. Use menu Build > Configuration Manager to open the Configuration Manager dialog box.
  2. Select a project in the Project column.
  3. In the Configuration drop-down list for that project, choose New.
  4. The New Project Configuration dialog box opens.
  5. In the Name box, enter a name for the new configuration.
  6. To use the property settings from an existing project configuration, in the Copy settings from drop-down list, choose a configuration (select Release). You can customize the settings later in the project property pages.

Build Multiple Configurations

To access Batch Build dialog, use the menu bar, Build > Batch Build.

Save Outputs to Different Folders

To output your executables to different folder and file names, you can set the OutputPath or OutputDir variables for each configuration.

More details on build configurations is on Visual Studio Site

Leave a Reply

Your email address will not be published. Required fields are marked *