✅ Could not load file or assembly 'StackExchange.Redis

AArkatme1/24/2023
What causes these errors? How do I fix it? The project builds find on my windows machine. But running it on my ubuntu server causes this error to occur. The server is running dotnet 7.0
Image
PPobiega1/24/2023
doublecheck your package references
PPobiega1/24/2023
does it build fine on your windows machine if you do
dotnet clean
dotnet build
AArkatme1/24/2023
Yes that builds fine
AArkatme1/24/2023
These are my package references
Image
AArkatme1/24/2023
@Pobiega any ideas?
PPobiega1/24/2023
Curious. You have 2.6.9 in your csproj, but its trying to resolve 2.0.0?
PPobiega1/24/2023
But other than that, no direct ideas.
AArkatme1/24/2023
Yeah I can't work out for the life of me where it's getting 2.0.0 from
Ttebeco1/24/2023
2.0.0.0 is the assembly version
Ttebeco1/24/2023
it's not the nuget version
AArkatme1/24/2023
Ah okay, any ideas how I can resolve the issue?
Ttebeco1/24/2023
close your IDE
Ttebeco1/24/2023
if you're using VS, remove the .vs/ folder
Ttebeco1/24/2023
open a terminal
Ttebeco1/24/2023
and dotnet restore --force --no-cache from the SLN folder
Ttebeco1/24/2023
and see if there's any warning or error doign that
AArkatme1/24/2023
No errors. Also, I'm using rider.
Ttebeco1/24/2023
hummmmmmm
Ttebeco1/24/2023
can you send the csproj as code not image
AArkatme1/24/2023
Image
Ttebeco1/24/2023
any minimal code to repro the issue if I create a console app with that ?
AArkatme1/24/2023
no not easily unfortunately
Ttebeco1/24/2023
(i had to turn off computer until a few hour but it's impossible to guess without more detail)
Ttebeco1/24/2023
the csproj is also a library
Ttebeco1/24/2023
so it needs also code from a consumer and a reference somehow
AArkatme1/24/2023
Yeah, it's meant to be a library
Ttebeco1/24/2023
yeah but i mean that it's impossible to repro with urgent context
Ttebeco1/24/2023
the file does not seemed to be copied
AArkatme1/24/2023
I just don't understand why it can't load this
ould not load file or assembly 'StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46'. The system cannot find the file specified.
Ttebeco1/24/2023
that's all we know
AArkatme1/24/2023
It used to be able to
Ttebeco1/24/2023
no file
Ttebeco1/24/2023
check the file on disk
Ttebeco1/24/2023
that error is on dev computer ? or deployed app ?
Ttebeco1/24/2023
or ci
AArkatme1/24/2023
both
Ttebeco1/24/2023
did you forget to use "dotnet publish" ?
Ttebeco1/24/2023
check the publish folder if there the dll there
Ttebeco1/24/2023
manually
AArkatme1/24/2023
I've never used dotnet publish for this library. Only for the console app
AArkatme1/24/2023
sorry, this library is a plugin for another console app
Ttebeco1/24/2023
yes that's right
Ttebeco1/24/2023
because publish is for apps
Ttebeco1/24/2023
and your error can only ever be on an app
Ttebeco1/24/2023
because a package don't run itself
Ttebeco1/24/2023
this error can only happen for a running app
Ttebeco1/24/2023
which could have improperly be published
Ttebeco1/24/2023
or incomplete copied
AArkatme1/24/2023
Ah okay that makes sense
AArkatme1/24/2023
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained false this is what I use to publish
AArkatme1/24/2023
Okay so I found out that if I add those packages to the main console project the errors go away
Ttebeco1/24/2023
you mean adding stsckexhange ref to the console that consume the nuget ?
Ttebeco1/24/2023
it's not exactly normal
Ttebeco1/24/2023
can you check without doing that and actually check if the file was on disk in the publish folder as mentionned above