C# .Net With React - Build Succeeds, Deploy Fails on Dependency
sterlingsilverf
HOBBYOP

7 months ago

Keep hitting a wall. Project ID: 6066f682-b9b0-497c-adb2-ca9621de525b

Unhandled exception. System.TypeLoadException: Could not load type 'Microsoft.Extensions.Diagnostics.Metrics.IMeterFactory' from assembly 'Microsoft.Extensions.Diagnostics.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
...
  at Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(String[] args)
   at Program.<main>$(String[] args) in /app/Program.cs:line 21

Relevant Program.cs line in case it matters:

var builder = WebApplication.CreateBuilder(args);

My running theory is that Nixpacks is attempting to use the preview version of .Net 8 when deploying, but despite me trying various sets to force it to use an official version, the error persists. So either I am barking up the wrong tree, or I am failing to configure it correctly. Would really prefer to avoid using docker since I am not very familiar with it.
The app has built and ran successfully on other platforms.

$10 Bounty

6 Replies

medim
MODERATOR

7 months ago

Dockerfile is the way with .NET applications


medim
MODERATOR

7 months ago

Railpack doesn't support it, I never managed to run .NET fine on nixpacks


sterlingsilverf
HOBBYOP

7 months ago

Any chance you could link a functioning example? I saw a few online but things change rapidly over time.


medim
MODERATOR

7 months ago

hmmm I remember helping a guy recently about this same issue but I can't find his thread anymore


medim
MODERATOR

7 months ago

I remember the Dockerfile being super simple


passos
MODERATOR

7 months ago

hey, I made one for .NET with minimal APIs
https://github.com/ThallesP/ASP.NET-Minimal-API


Loading...