✅ Make C# Application work directory independent, relativ work directory for exe file
Hello guys,
I want my C# Application Executable Everywhere, also on other PC's, currently my exe file is only working in my work directory.
I know its a very beginner question, but I am new :)
Thanks.. c:
15 Replies
Why does it not work elsewhere, exactly?
Any errors or something?
Its not opening, instantly closing
Well, my first idea is that you might be using absolute paths somewhere and not catching the exception if the file could not be found
So it just crashes
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I need the datas hmm :/
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Ah, so you were using just the exe?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
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: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
And you will need all the files that you get from the publishing
Or, yeah, a singlefile build
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
yea
DONE
It worked
Lol good to know
Thanks guys for your help and time I am appreciate it :)
@TeBeCo - @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Use the /close command to mark a forum thread as answered
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View