The `dotnet build` command from .NET SDK 10 fails with exit code -1 when run by AppVeyor service
We're unable to run builds on servers in Windows PowerShell. We have a dotnet build command that on .NET SDK 10 under Windows PowerShell, exits with a -1 exit code, with no console output and no log output.
Build history is here: https://ci.appveyor.com/project/WebMD-Health-Services/whiskey/history
Build script we're running: https://github.com/webmd-health-services/Whiskey/blob/master/build.ps1 . The failing dotnet build command is on line 188. For the repo and it should repro.
Sometimes, if I repeatedly run the dotnet build command, it will sometimes eventually work, but not always (I've only ever tried for at most five minutes).
If I pin to .NET 8.0 instead of LTS (which currently resolves to .NET 10.0, the problem goes away.
If I log into the build server interactively, the dotnet build command and the build.ps1 script always work. It is only an issue when running non-interactively by the AppVeyor service.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

Support Staff 1 Posted by Owen McDonnell on 03 Dec, 2025 06:55 PM
Are you able to build on a newer image,
Visual Studio 2019orVisual Studio 2022?2 Posted by splatteredbits on 03 Dec, 2025 07:07 PM
It fails on the Visual Studio 2019 and Visual Studio 2022 images as well: https://ci.appveyor.com/project/WebMD-Health-Services/whiskey/build...
Support Staff 3 Posted by Owen McDonnell on 03 Dec, 2025 10:16 PM
Can you change
Write-Verbose "dotnet build $($params -join ' ')"toWrite-Host "dotnet build $($params -join ' ')".It would help to see the actual complete build command that is being called is.
4 Posted by splatteredbits on 03 Dec, 2025 10:52 PM
Done. I turned on verbose output for that message. I also added a message that shows the exit code before the command and after.
Support Staff 5 Posted by Owen McDonnell on 03 Dec, 2025 11:15 PM
Thanks.
Sorry, i didn't realize your build log was not being uploaded on failing build.
Can you follow docs here to push
C:\projects\whiskey\.output\msbuild.whiskey.logto artifacts on build failure.6 Posted by splatteredbits on 03 Dec, 2025 11:26 PM
Done. Unfortunately, it doesn't even generate a log file. I've updated appveyor.yml to publish all the *.log files, but you'll see they aren't there. I added verbose messages to the build script that shows the .output directory is empty. I even increased the log level to diag for the log file.
Support Staff 7 Posted by Owen McDonnell on 04 Dec, 2025 07:29 PM
I've forked your repo and am trying to assess the issue. I'm trying to determine if it's a problem with the build machine image or with newer dotnet sdk and/or powershell.
What was the last successful build with dotnet 10? Was it on
Visual Studio 2017image? That image hasn't changed for quite some time. Can you successfullyRe-Build Commitof last successful build?Also, when you say you can RDP to the worker and run the
build.ps1script, are you doing that in powershell core?8 Posted by splatteredbits on 04 Dec, 2025 07:39 PM
I don't think we've ever had a successful build with .NET 10. I'll have to review logs.
I'm running build.ps1 in Windows PowerShell, same as the build should be running.
9 Posted by splatteredbits on 04 Dec, 2025 07:45 PM
Here's our last successful build running, 15 Oct 2025, on all the images we want, which included Visual Studio 2017: https://ci.appveyor.com/project/WebMD-Health-Services/whiskey/build... . If I rebuild that commit it will fail, because the build script pins to the .NET LTS, not a specific version. It will download .NET 10 SDK.
The next build ran a month later on 17 Nov 2025. It downloaded and used .NET 10 SDK. and failed. https://ci.appveyor.com/project/WebMD-Health-Services/whiskey/build...
10 Posted by splatteredbits on 04 Dec, 2025 07:47 PM
I am also not sure if this is a problem with .NET 10 SDK or your service/VMs. I reported https://github.com/dotnet/sdk/issues/51982 to the .NET SDK GitHub project, but have yet to receive any response.
Support Staff 11 Posted by Owen McDonnell on 04 Dec, 2025 09:33 PM
Can you try changing your build script to
pwsh:instead ofps:and let us know if there is any difference in terms of build output?12 Posted by splatteredbits on 04 Dec, 2025 09:38 PM
The problem does not happen when run under PowerShell/pwsh: https://ci.appveyor.com/project/WebMD-Health-Services/whiskey/build... .
Support Staff 13 Posted by Owen McDonnell on 05 Dec, 2025 01:43 AM
Either use powershell core, or remove
$ErrorActionPreference = 'Stop'from your build script.Seems that new dotnet cli is outputting something to stderr.
I guess AppVeyor powershell session differs from a live one, but regardless, I don't think this is something that can be resolved by our updating build images.
14 Posted by splatteredbits on 05 Dec, 2025 01:45 AM
We can't use PowerShell Core since we need to test that our PowerShell module runs on Windows PowerShell.
If we remove
$ErrorActionPreference = 'Stop'our build will still fail becausedotnet buildwon't compile our project.Support Staff 15 Posted by Owen McDonnell on 05 Dec, 2025 07:20 PM
In that case you could use this function to call the dotnet command.
Put that function in a ps1 file in your repo and then dot source it at the start of your appveyor.yml build script section. Then call
Start-ProcessWithOutput "dotnet build $params".There's also a flag for ingoring exit codes.