C
C#3mo ago
Andershow38

✅ Errors with my API

Hello everyone, I'm new about API's and I've struggled a lot when I try to deploy my API on railway. I've tried many times but I just can't make it work... Locally it does work as it should however online on railway I've got many mistakes and the biggest one that I have no clue how to solve is this one: Unhandled exception. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Unhandled exception. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=8.0.7.0, Culture=neutral, PublicKeyToken=xxxxxxx'. The system cannot find the file specified.
8 Replies
blueberriesiftheywerecats
Try calling dotnet restore in project folder
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX3mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Andershow38
Andershow383mo ago
So I go through tools and there I open up a command line, then I try to use "dot net publish"?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Andershow38
Andershow383mo ago
I've already tried but same mistake happened Thanks for the hints, I'm taking a loot at it right now
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX3mo ago
dotnet publish -c Release -r <runtime identifier> -p:PublishSingleFile=true Use of -p:PublishSingleFile=true implies --self-contained true. Add --self-contained false to publish as runtime-dependent. -r RID and -p:PublishSingleFile=true can be moved to .csproj as the following properties:
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
but to target multiple RIDs, you have to use dotnet publish with the -r option for each RID. You can also add -p:IncludeNativeLibrariesForSelfExtract=true to include native libraries (like Common Language Runtime dlls) in the output executable. You might want to instead publish your application compiled Ahead Of Time to native code, see $nativeaot for examples. Single file publishing | Runtime Identifier (RID) catalog | dotnet publish
Want results from more Discord servers?
Add your server