How to run MSBuild.exe as admin from the command line in GitHub pipeline?

Phani 46 Reputation points
2022-06-06T11:08:55.18+00:00

I'm using a simple step in Github pipeline to build a project:

- name: Build Solution
    run: |
      msbuild.exe ${{ env.PROJ_PATH }} /p:Configuration=Release

I need this command to run in elevated mode. (e.g If I'd compile this project manually, I'd open Visual Studio as administrator.)

How can I do it in the command?

Thank You!

Community Center Not monitored
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-06-06T15:23:05.107+00:00

    as the GitHub pipeline runs on linux, it is the sudo command. But you need the superuser password to use sudo. why would you need su permission for a build?

    0 comments No comments

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.