I'm creating a C# app which I have build or as they call it "published" for linux-x64 following this XML in the csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Configuration>release</Configuration>
<InvariantGlobalization>true</InvariantGlobalization>
<TargetFramework>net5.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="mongocsharpdriver" Version="2.11.6" />
<PackageReference Include="MongoDB.Bson" Version="2.11.6" />
<PackageReference Include="MongoDB.Driver" Version="2.11.6" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.11.6" />
<PackageReference Include="PCSC" Version="5.0.0" />
<PackageReference Include="PCSC.Iso7816" Version="5.0.0" />
</ItemGroup>
</Project>
I'm on Linux Ubuntu 20.04 .
I published the application using CLI to the folder bin/release etc etc. It ran just fine when I tested it. Now, for the main branch, I deleted all code. Moved the directory release up in the main directory, and pushed it to GIT.
Whenever you try to run it now, it gives the following error:
./Appname: relocation error: ./Appname: symbol pthread_attr_init version GLIBC_2.2.5 not defined in file libpthread.so.0 with link time reference
As I'm not a native C# developer and still learning, I have absolutely no idea what this is about, except it apparently has something to do with me moving the directory (I quess?)
Does anyone know what this error is or where it comes from, how to fix it, and how to prevent in the future? As I would like to be able to publish an application without errors.
solved
I Found the answer. There is another directory within the build directory called "publish" which contains the working executable. In other words. The exe is in the folder release/net5.0/linux-x64/publish
instead of release/net5.0/linux-x64
. When I run the executable from that directory, everything works just fine. For other newbies: It is in the folder release
because my XML project file has a Configuration field
set to release
. It is in the folder Debug
by default.