Table of Contents
Publishing apps in GitHub with a workflow
Have you ever set up a GitHub Actions workflow for a .NET project, only to be hit with the dreaded MSB1009: Project file does not exist
error when running dotnet publish
? Yeah, me too. It’s frustrating, but the fix is easier than you think.
Are you publishing an app with actions/setup-dotnet@v4
in a GitHub workflow? And do you receive the same error as below?
MSBUILD : error MSB1009: Project file does not exist.
Switch: Files/dotnet/myapp
Error: Process completed with exit code 1.

This happens because of compatibility issues in newer versions of the actions/setup-dotnet
action. If you’re using @v4
, it’s likely causing problems with detecting and setting up your .NET SDK properly.
When running a GitHub Actions workflow with dotnet publish
, you might encounter an error like this:
This happens because of compatibility issues in newer versions of the actions/setup-dotnet
action. If you’re using @v4
, it’s likely causing problems with detecting and setting up your .NET SDK properly.
Let’s just downgrade a version to actions/setup-dotnet@v3
!
Instead of using v4
, downgrade your workflow to v3
: actions/setup-dotnet@v3
.
Modify your GitHub Actions YAML file like this:
- name: Use dotnet sdk 8.x (needed for dotnet commands)
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
This ensures that GitHub Actions properly sets up the .NET SDK and allows dotnet publish
to find your project files.
Why does this work?
The v4
version of actions/setup-dotnet
introduced changes that might not fully support certain project setups.
By using v3
, you get a more stable and tested environment that works seamlessly with most .NET workflows.