how can i automate the vs project using python to compile and build

Lakshay Goel 10 Reputation points
2023-03-14T17:41:53.29+00:00

i want to write a python script to automate the building process for the visual studio projects

Developer technologies | Visual Studio | Other
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2023-03-14T18:10:50.1733333+00:00

    The VS build process consists of just calling MSBuild and passing it the name of the project/solution and any customized parameters (such as configuration). Use the standard Python script that can invoke another process to do this.

    msbuild mysolution.sln -t:rebuild -property:configuration=Release
    

    Note that you need to ensure the environment is set up properly for this. Refer to the "Developer Command Prompt" that was created when you installed VS. It references a command shell script that sets up the environment needed to build in VS. Replicate the setting of the env vars that you need for your environment and then call MSBuild.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.