15 ms·
1. Install the .NET 6 SDK: https://dotnet.microsoft.com/en-us/download/dotnet/6.0 https://dotnet.microsoft.com/en-us/download/dotnet/6.0 2. Terminal ,pick a fo
by Dayshine 5y ago
1. Install the .NET 6 SDK: https://dotnet.microsoft.com/en-us/download/dotnet/6.0 https://dotnet.microsoft.com/en-us/download/dotnet/6.0
2. Terminal ,pick a folder, `dotnet new wpf`
3. `dotnet run` and you have an (admittedly empty) hello world app
It's telling me it took 1.5s to build the app.
Want to publish the app?
`dotnet publish -o ./publish -r win-x64` which takes a bit longer as it has to download some runtimes (60 seconds max, then cached). Zip up the resulting folder and ta-da you have an application. Just unzip and run the .exe.
If you want a single-file exe (as in completely statically compiled without self-extraction) that's a bit more advanced and requires a few properties in the csproj to configure how to handle native assemblies that expect to exist on disk. If you want it to have no runtime dependencies, add `--self-contained`
- vixalien 5y agodotnet does not work with winui3 apps. I can't link the relevant stackoverflow answer from a microsoft dev. You can only use msbuild.
- oblio 5y agoThat's pants on head stupid.
- sixothree 5y agoHow so exactly?
- oblio 5y agoThe fact that 2 major Microsoft products don't integrate fully.
- pjc50 5y agoThey're two almost-identical pieces of software that parse almost-identical file formats. They may or may not share a codebase (five minutes on github hasn't clarified this), and in most cases you can substitute one for the other. Except this one. And the developers (of whom there are not many for WinUI!) forgot this use case because they're focused on building inside VS.
- no_time 5y ago>has to download some runtimes As someone who had to develop software in an airgapped enviroment, I'm sending a special "fuck you" to whoever thought this is a good idea. God forbid you have the AUDACITY to not be connected to the internet at all times for any reason whatsoever.
- amelius 5y agoYes, I hate it when software that I thought was fully installed unexpectedly starts downloading more stuff when I run it. What if I installed the software with the intention to run it without internet, or 5, 10 or 100 years in the future?
- visarga 5y agoApparently in those 20GB there was no place for the runtime?
- Dayshine 5y agoThe installer for the sdk is 200MB
- pas 5y agothe default is online now for development, so nowadays by default if you need offline you need to test it :/
- marginalia_nu 5y agoWho gets to decide what is the default?
- marcosdumay 5y agoOn this case, Microsoft. It's their private garden, you are invited by their rules. And yes, this sucks. But if you want freedom, there are other OSes (or even other dev tools) where you can have it.
- dmitriid 5y ago> If you want a single-file exe that's a bit more advanced and requires a few properties in the csproj. This. This is what's wrong. Why is single-file exe "a bit more advanced". In early 2000s Delphi could build a single file exe in seconds, and that was the default behaviour. What changed since early 2000s that having an exe is a) advanced and b) requires manually fiddling with some unspecified properties in the abomination that is a csproj file?
- Dayshine 5y agoEmbedding native assemblies inside another application is apparently very hard. I'm not sure I know any frameworks that easily support arbitrary native .dll/.so inside the application executable.
- oblio 5y agohttps://www.joelonsoftware.com/2004/01/28/please-sir-may-i-have-a-linker/ https://www.joelonsoftware.com/2004/01/28/please-sir-may-i-h... Strategic decision from Sun and Microsoft that has crippled software for 2 decades already.
- xyzzy_plugh 5y agoThe rest of the world refers to this as "static linking" and it is, in fact, trivial.
- julik 5y agoIt is trivial if you can embed most of the OS inside of your executable, if there can be only 1 version of the OS, if you do not use any libraries you cannot statically link and so on.
- 6nf 5y agoIt's amazing that most people on this thread seems to take this nonsense as being completely normal and acceptable now. It really shows how much windows dev has devolved over the last decade.
- gusennan 5y agoThis is my experience as well building and running .NET core stuff on Arch Linux all the time. You just have to know what you're doing, and the Microsoft documentation doesn't make it easy to take the minimalist route. Microsoft could do a much better job onboarding new developers.
- syshum 5y agoMicrosoft wants to sell Visual Studio, this is why Visual Studio Code will never get a GUi Designer, or have easy compile options for C#. Hell just recently they were trying to take away hot reload to keep that feature as a paid feature only part of VS
- gusennan 5y agoThat's true. I only really started liking .NET when I stopped using visual studio a few years ago.
- dleslie 5y agoAh yes, VS' hot reload that insists on popping up a dialog every time a file changes. Garbage.
- pjmlp 5y agoVisual Studio Code only needs to be good enough for a Cloud IDE kind of scenario for Azure workloads (it started that way as Monaco anyway), anything beyond that is a gift so to speak.
- MikusR 5y agohttps://visualstudio.microsoft.com/vs/community/ https://visualstudio.microsoft.com/vs/community/
- syshum 5y agoI am aware of the community edition, which the most recent versions have a VERY restrictive license on the acceptable uses for the community edition The fact this edition exists does not change my point, or really add anything of value to the conversation
- deleted 5y ago[deleted]
- Pxtl 5y agoSometimes I feel like the Visual Studio team and the C# team don't talk to each other very much. The C# team says "this is the new best practice" while VS still drives you to The Old Way all the time.
- Jorge1o1 5y agoYour gut feeling is very correct. https://news.ycombinator.com/item?id=28972431 https://news.ycombinator.com/item?id=28972431 There was a whole fiasco where the dotnet/C# team were forced to remove features from dotnet in order to sell more copies of Visual Studio. Later, Microsoft lied through their teeth and said it was some kind of sprint-planning scoping error, even though the development work was already done.
- MikusR 5y agoWorst part is that the person that made the decision to remove that feature was promoted. And now indirectly controls GitHub.
- PraetorianGourd 5y agoYou have absolutely no idea what you are talking about. Full disclosure: I know what I am talking about
- pjmlp 5y agoIt is quite easy, the ASP.NET folks on the C# team don't care about the remaining use cases, and they are the ones behind the initial .NET Core reboot. Except, everyone else cares about everything else .NET Framework has been used for the last 20 years. This was quite telling on the .NET 6 release with its minimal APIs to compete against Python and JavaScript "hello world" apps. As soon as one scales beyond that, it is back to the old MVC model.
- anaisbetts 5y agoThis Is The Way. You don't typically need a single-file EXE, `--self-contained` is Fine.
- pjc50 5y agoThis is probably the easiest way. The tragedy is that this explicitly rejects all the subsequent developments since WPF - UWP, WinUI3 - because they don't work nearly as well. If you want an installer BTW, use "Wix". If you are eligible for VS Community, do give it a go: https://visualstudio.microsoft.com/vs/community/ https://visualstudio.microsoft.com/vs/community/ since that has the WPF designer in (the WinUI3 designer is inexcusably broken)
- Tempest1981 5y ago> the WinUI3 designer is inexcusably broken I just tried VS2022, and the UI designer for WinUI3 is completely non-functional? What is the recommended approach to lay out the UI pages these days?
- pjc50 5y agoRealistically you have three options: - ignore Winui3 and do it in WPF (fewer controls, deprecated, actually works) - do it blind in XAML, possibly with the aid of a piece of paper. Or the "live view" in VS if that works. (Live View is the suggestion given on the github issue for "designer doesn't work", fwiw) - do it in the UWP designer, then s/Windows/Microsoft/ in the control namespaces
- chrisandchris 5y agoThat's what i really love about the MS ecosystem. There are actually 3 ways to achieve a task, but none of it works fully end-to-end.
- jhanschoo 5y agoholy shit
- p2t2p 5y agoExactly. And then people wonder why everything is electron nowadays. Native UI development on any platform is pure garbage compared to frameworks in Web frontend. I hope SwiftUI and flutter will be able to make it at least a little bit better.
- dustymcp 5y agoThis, .net core is quite a pleasure..
- choiway 5y agoThis is the best response I've seen to the question: "What's the easiest way to get started developing a native Windows app". Better than anything Microsoft has put out. Isn't WPF getting phased out tho?
- Shadonototra 5y agodotnet is a stack for slow servers who love cold start wpf is a stack for slow bloated apps (200mb for a hello world and 300 dlls) even electron is lighter than this.. electron.. microsoft needs its swift + swiftui moment
- deleted 5y ago[deleted]