Shaul Behr
Shaul Behr

Reputation: 37993

Dotnet build on Ubuntu returns code 1

I have a .NET Core 2.1 solution that compiles fine in a Windows environment. When I attempt to build it in an Ubuntu environment, it appears to have compiled successfully:

267 Warning(s)

0 Error(s)

but it returns an exit code of 1 (should be 0). I dug back through the logs and found:

Build FAILED.

but there are no errors anywhere in the output, and no clue as to why the build failed!

How do I diagnose this problem?

Upvotes: 0

Views: 175

Answers (2)

Martin Ullrich
Martin Ullrich

Reputation: 100543

How do I diagnose this problem?

Add the -bl argument to generate a msbuild.binlog (or use -bl:/path/to/build.binlog) file which you can later analyze using the MSBuild Binary and Structured Log Viewer to look at the failure source and try to better understand the issue.

Upvotes: 1

Shaul Behr
Shaul Behr

Reputation: 37993

Well, I can't answer the question directly (how to diagnose), but I did manage to diagnose the problem anyway.

dotnet build by default creates artifacts for the Windows environment. If you want a build to work in Linux, you have to specify that in the command line arguments, e.g.

dotnet build -r linux-x64

So while compilation was working fine, it couldn't create any Linux compatible binaries!

D'oh!

Upvotes: 0

Related Questions