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!

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,274 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,144 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,686 Reputation points
    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