Skip to content
v7 is in preview. Install it with dotnet tool install dotnet-affected --prerelease, and see what changed since v6.

Exit codes

Code Meaning
0 Projects changed and/or are affected. Output files were written.
166 Nothing changed and nothing is affected. No output files were written.
other An error occurred. The message is printed to stderr.

When the diff produces no changed projects and no affected projects, the tool prints No affected projects where found for the current changes and exits with 166. Since no affected.proj is written, running dotnet build affected.proj afterwards would fail on a missing file — so guard it:

Terminal window
dotnet affected # ...other args
if [ "$?" -eq 0 ]; then
dotnet build affected.proj
fi

With the dotnet-affected action, the same idea is expressed as a step condition:

- name: Install dependencies
if: success() && steps.affected.outputs.affected != ''
run: dotnet restore affected.proj