Is Github Workflow Action support C# DotNet Now? (Not .NET Core, I'm asking .NET)

Is Github Workflow Action support C# DotNet Now? (Not .NET Core, I’m asking .NET)

Is this file work on .NET  (not .NET Core)?

Hi @yang09701194 ,

Github actions supports any languages including C# DotNet. The file (dotnet-core.yaml) refered is a dotnet core workflow yaml file sample.

If you’d like to build .Net project, you can directly call ‘msbuild.exe’ which is installed on github hosted runner already, code sample as below:

    runs-on: windows-2019
      - name: checkout
        uses: actions/checkout@v1
      - name: Build DotNET35
        run: |
           cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\"
           .\MSBuild.exe $Env:GITHUB_WORKSPACE\pathtoyoursolutionorproject

Or use below actions 'warrenbuckley/Setup-MSBuild’:

    runs-on: windows-latest

    - uses: actions/checkout@master

    - name: Setup MSBuild.exe
      uses: warrenbuckley/Setup-MSBuild@v1

    - name: MSBuild
      working-directory: src
      run: msbuild MyProject.csproj

Hope it helps!


Thank you, it works!

Add some description of my try for anyone new to this, the GITHUB_WORKSPACE of $Env is seen as repostiroy root,

so suppose my Id is Yang09701194 , the repository name is  YangTestWorkflowAction ,

the sln file relative path is   Yang09701194/YangTestWorkflowAction/ConsoleApplication1/ConsoleApplication1.sln

then write  $Env:GITHUB_WORKSPACE\ConsoleApplication1\ConsoleApplication1.sln works.

I have created an Example:

Build Succcess:

Workflow file:

1 Like

is there a way to use MSBuild version 12 in github actions?

tried using this in the workflow steps 

run: |
cd “C:\Program Files (x86)\MSBuild\12.0\Bin”


but it says it is not found in this location?