Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 4

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

Solved! Go to Solution.

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

 

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

https://github.com/actions/starter-workflows/blob/master/ci/dotnet-core.yml

3 Replies
Highlighted
Solution
GitHub Partner
Message 2 of 4

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

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:

jobs:
  build:
    runs-on: windows-2019
    steps:
      - 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':

jobs:
  build:
    runs-on: windows-latest

    steps:
    - 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!

Highlighted
Copilot Lvl 2
Message 3 of 4

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

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: https://github.com/Yang09701194/YangTestWorkflowAction/actions/runs/55459054

Workflow file: https://github.com/Yang09701194/YangTestWorkflowAction/actions/runs/55459054/workflow

Highlighted
Copilot Lvl 2
Message 4 of 4

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

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\"

.\msbuild.exe

 

but it says it is not found in this location?