C
C#10mo ago
amer

wpf exe issue

I made an wpf login gui i started yesterday when i run the exe on its original spot it works but when i put the exe on the desktop it stops working and asks for .net i installed .net restarted still same issue
6 Replies
Jimmacle
Jimmacle10mo ago
programs aren't always just exes, they can depend on other files in the build output directory
amer
amerOP10mo ago
so do u suggest i just make an installer that installs the files required?
Jimmacle
Jimmacle10mo ago
that is an option, you can also configure your project to publish as a single file
amer
amerOP10mo ago
what kind of files will it publish to?
Jimmacle
Jimmacle10mo ago
a single exe $singlefile
MODiX
MODiX10mo 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