0

I'm setting up an automation script that includes pulling from Git server and publishing the web application. This is the part of my code who is using MSBuild.exe.

I've managed to use the MSBuild.exe of visual studio to Build the code but now I need to publish the web application after the build

p = subprocess.Popen(['C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\MSBuild.exe', filename], shell=True,
                     stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():  
    if (line.find("Build succeeded,") != -1):
        print("Contains substring 'Build succeeded,'")
    else:
        print("Doesn't contain substring")
ret = p.wait()

The result expected is to eventually Publish web application using a python script like my code is using the MSBuild.exe.

5
  • You can build the code by sth like: msbuild.exe xxx.csproj. To build and publish it, the command may looks like: msbuild.exe xxx.csproj /p:DeployOnBuild=true /p:PublishProfile=... Not familiar with python, but I think you can find the way to pass these values into the process.
    – LoLance
    May 16, 2019 at 10:00
  • Do you have some documentation for your approach?
    – Dor Shamay
    May 16, 2019 at 10:11
  • Check this document and this one.
    – LoLance
    May 16, 2019 at 10:32
  • Hi Dor, any update? Can the command work?
    – LoLance
    May 20, 2019 at 2:07
  • It was helpful but I need help to implement this approach to python.
    – Dor Shamay
    May 20, 2019 at 7:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.