✅ Deploying WPF APP
Hi, i'm a bit lost with all the informations i've found like .net Framework, .net Runtime, Publish ClickOnce etc. I'd like to have some help to deploy my wpf app.
To summ up i've developped an wpf app which :
- Use .Net 8 Framework
- Target Windows 10 .0.17763
This app is destinated to be set on a computer which isn't connected to Internet by using a usb key. So basically i thought about an installer which include the framework if needed to download and have all the stuff related to my app to set everything on the offline computer.
How i'm am supposed to do ? Do i need to create an installer by myself or the publish tool on visual studio is supposed to work if well configured ?
23 Replies
Okay, so you have a few options
You could skip the need for an installer by just bundling the runtime with the application
or you make an installer, maybe with WIX
And a correction:
.NET 8
is only .NET 8
, no framework suffix added. .NET Framework
is a different lineage and is the legacy version.
If you decide to just bundle the runtime, thats what we call a "self contained application", and the dotnet publish
command has all you need to do itokay then i just have to move the generated files in
publish
into the offline computer right ?yep
You can read more about it here
$singlefile
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
OK i'll look that and i have one more question, i didn't understand the diffrence between the .net 8 et the Framework, like is is possible that my app can't be run on the computer because the
.NET Framework
isn't with the correct version ?.NET 8 has nothing to do with .NET Framework
different products, different lineage
.NET 8 is a decendant from .NET 5, which came from .NET Core, which was a from-scratch rewrite of .NET Framework for multiplatform support.
its an entirely different runtime
ok so for my case if the computer do not have .NET 8 i can do the "self contained application" in order to avoid any compatibility issue right ?
and the whole point of a self-contained build is that it contains the runtime itself
yes
you get a bigger executable as a tradeoff
but thats usually not a problem
ok that's it i understand now, the size do not matter for my case so i'm good with it. It will avoid me some setup to do if id do it this way 🙂
and last question is about the update, because in the future i would be able to update the wpf app even without connection on the computer by using usb key. Does
ClickOnce
could help me to do that or i should create my own console app to Copy Paste
the good file ?ClickOnce is nothing but trouble, imho
And if the app is self-contained and developed properly, storing user data in %appdata% etc, then just replacing the files should be enough
ok i think i've understand the whole stuff i needed, to summ up i've 2 possibilities :
First is to copy paste the publish file in the offline computer
Second solution is to create an installer that will do this "copy paste" and add other stuff that if needed
yep.
you could quite easily write your own installer/updater for this
or use WIX
apparently WIX is quite difficult to get the hang of, but it does produce very professional installers
ok you've helped me a lot cause i was really confused with clickonce and all these stuff in publish
i will look for it cause i need something "pro" to have something user friendly in order to easily install and update my app
But it can only update via the USB key, no?
yes cause the computer is offline
so every new version of the app will be updated on the offline computer from a usb key
you mentionned something i didn't do on my app about the %appdata% that i will have to do in order to save the data correctly 😄
I would maybe consider having an in-app "Update from USB key..." option then
where you simply select the drive that has the program files on it, and it updates itself (using an
elevator.exe
approach)
ie, a second executable. The main program first updates the elevator, then runs it, then shuts itself down, the elevator updates the main program and runs it
this is how for example JetBrains Rider updates itselfoh ok sound great to my case ! And does the
selfcontained
publish include all the .dll
files and librairies stuffs ? so it only has to update the .exe ?singlefile +
-p:IncludeNativeLibrariesForSelfExtract=true
should include most if not all files
I've never tried with WPFI will look. I won't bother you anymore you gave me everything i will do some more research on what you said thanks !
Unknown User•11mo 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
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Use the /close command to mark a forum thread as answered