Dotnet build and run in the same job

I’m trying to both build and run a c# project in an action workflow.
For now I have the following:

> jobs:
>   build:
>     runs-on: 'windows-latest'
>     steps:
>       - name: Checkout
>         uses: actions/checkout@v2
>       - name: Setup dotnet
>         uses: actions/setup-dotnet@v1
>         with:
>           dotnet-version: '5.0'
>       - run: dotnet build DictionaryPhoneCheck/src/DictionaryPhoneCheck.csproj
>       - run: dotnet run --project DictionaryPhoneCheck\bin\DictionaryPhoneCheck.dll -- Languages/

I’m getting this error:
The build failed. Fix the build errors and run again.
[8]MSBUILD : error MSB1009: Project file does not exist.
[9]Switch: DictionaryPhoneCheck/bin/DictionaryPhoneCheck.dll

I’ve tried changing the path for the dll, same error.

Do I need to create an artifact and a second job which pulls this the artifact for this to work?

Hello @GlissaTheTraitor. You might want to setup a dependency with need:

1 Like