dotnet

AnonymousTRIAL

9 months ago

Attempting to build dotnet apps fails at dotnet restore step. Tried with two brand-new projects, minimal APIs in F# and C#, nothing fancy. Previously building and deploying single-project repos was a breeze - would love to not have to manually add a dockerfile. Targeting the .NET 8 runtime - project created with dotnet new web, spun it up locally to make sure it worked, pushed to github and tried to deploy.

Projects:
9687eb42-691c-430b-962b-9129b1705d22
0301d141-a811-4b07-9474-a46be8801627

Dockerfile:19
-------------------
17 |     # install phase
18 |     COPY . /app/.
19 | >>> RUN  dotnet restore
20 |
21 |     # build phase
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c dotnet restore" did not complete successfully: exit code: 1

Error: Docker build failed

0 Replies

AnonymousTRIAL

9 months ago

Whoops forgot to update title to something better


9 months ago

please include the actual error


AnonymousTRIAL

9 months ago

The error from the build output is included below the project IDs


9 months ago

that is just a log saying there was an error


AnonymousTRIAL

9 months ago

Where would I find the error?


9 months ago

further up in the logs


AnonymousTRIAL

9 months ago

Ah this is it, couldn't read the whole thing until I copied it out of the log viewer

#10 1.249   Determining projects to restore...
#10 1.258 /nix/store/0f43yfx91hg74bcp66qkbp97zv3ln27i-dotnet-sdk-6.0.413/sdk/6.0.413/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 7.0.  Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 7.0. [/app/my-first-giraffe.fsproj]
#10 ERROR: process "/bin/bash -ol pipefail -c dotnet restore" did not complete successfully: exit code: 1

AnonymousTRIAL

9 months ago

The builder doesn't have the correct sdk installed


9 months ago

may I ask why you thought the portion of the build logs you included was the error? perhaps the scroll bar didn't show?


AnonymousTRIAL

9 months ago

Been a while since I had to parse through these - saw something that said ERROR pointing to the step that failed


9 months ago

try setting NIXPACKS_CSHARP_SDK_VERSION


AnonymousTRIAL

9 months ago

Nice, thanks! Worked great for the C# project, no effect on the F#, which isn't that surprising since the F# nixpacks docs page doesn't mention it


AnonymousTRIAL

9 months ago

wonder if the global.json method would work


9 months ago

it doesn't look like the f sharp provider supports specifying a SDK version, you would have to write a simple dockerfile for that


AnonymousTRIAL

9 months ago

Bummer, - but thanks for the help! Just a heads up, it appears that the C# provider, even with the NIXPACKS_CSHARP_SDK_VERSION version set, is using a preview version of dotnet 8 - which hit GA last November.


9 months ago

may I ask why that's a bummer? you get far more control over how your app is built with a dockerfile


AnonymousTRIAL

9 months ago

I'm into Railway for the no-fuss deployment, and usually everything "just works". Haven't touched a dockerfile in a couple years since I switched jobs and love just being able to git-push and it does its thing. I know it's trivial to set up, but it's really just the fact that I have to do it at all


9 months ago

I see, thank you


AnonymousTRIAL

9 months ago

Of course, and thanks again!


AnonymousTRIAL

9 months ago

Do I mark this as solved or is that a you thing?


9 months ago

that one because it's going to be the answer to not using a preview version