by Dayshine · 4y ago · 0 comments
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`
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.
Syncing / uploading then happens once they have signal again. Or in the case of the Garmin I copy the FIT file off by hand when plugging it into my computer.
No log in, no external services.
Even if it cost money to install, you are just paying for the privilege of being tracked by those folks instead of others.
#appsnotevenonce
- Sygic,
- Topo Map+,
- 2GIS
- Starwalk - Night Sky 2
- and my fav, Genius Map
all works without WiFi, cell coverage, nor NFC/bluetooth
Hardware is cheap, network is reliable. Move fast and break things.
Neither of these assumptions are true, and we're going to have these issues by truckload, until we understand and change our mindset.
At least the website works, even though it transmits the full site for every request...
Scuba diving spots on the world are rarely well covered with internet and even if they are, still many people don't have the roaming/local SIM solution for it.
Guess where you want to use that damn app the most?
Discovered this when I tried to add a WiFi password before connecting to it.
Not a great way to get new customers though as it requires missing out on logging a ride to become aware of a reason to buy.
https://www.verizon.com/about/news/how-far-does-5g-reach
> 5G Ultra Wideband network’s signal can reach up to 1,500 feet without obstructions
I certainly wouldn't want to ask that the other 99% of the world's developers avoid a feature that's useful to them just to assuage my feelings of envy about the convenience they enjoy.
Nope. The exe files are supposed to do it's thing without internet and no extra effort like it was for a long time.
This does mean that certain programs just won't work, or won't work without some finagling. That's also a feature. The price of control is having to control things.
Granted, most people don't want to pay that price, and prefer convenience. That's admittedly not to my own taste - c.f.) log4j for a good example of why - but I think I'm maybe a little weird there. I certainly don't think there's anything audacious about catering to majority tastes. Maybe just vaguely disappointing.
Yes, technically easy but if their work environment is strict enough to enforce air gapped development, I imagine the bureaucratic process to accomplish such a thing to be a bit less than easy.
I wouldn't say the campfire was ruined, by my goodwill toward this product certainly was.
Your goodwill deterioration does not matter unless you switch a new a app[1], and a) Make sure that new app can function without internet, and b) Tell your current app developers why you are switching.
So, yeah, your goodwill is irrelevant is you're still giving them money or value. [1] I assume that it's a subscription - most things are nowadays.
Usually you had to dig a bit and could find an "offline installer". Sometimes an "alternate downloads" link is on the initial download page, sometimes you have to good to find a deeper link on the vendor's site.
I always did that just to keep from needlessly reaching out to the internet X times when updating X machines.
And of course, make sure you're getting it from the vendor and not some sketchy download site.
What if I installed the software with the intention to run it without internet, or 5, 10 or 100 years in the future?
You can download all versions of Android if you want, but i doubt that you would want that.
This is important because I support each release of the distribution for up to 10 years, and have some customers who may need to build it in an air-gapped environment.
[0] https://chiselapp.com/user/rkeene/repository/bash-drop-netwo...
Personally, I just run things in network namespaces with "ip netns exec offline|wireguard $COMMAND" to restrict net access.
I thought about using a network namespace, but that would make things more complicated since I would need to re-call my shell script to pick-up where I left off (because it requires creating a new process). I initially tried to implement this using network namespaces, but you cannot "unshare" the current process, you must spawn a new process.
With dropnet I can do
download()
enable -f ./dropnet.so dropnet
configure()
build()
install()
With "unshare" I would need to do more work to get to "configure()" in a new process.In this particular scenario, my first thought was "shoulda used golang".
I hear tell that since then (1+ yrs ago) matters have improved in the realm of MS standalone apps (well, maybe just cmd line apps).
oh, and the exe is round about 65mb compared to a golang ~5 or 6mb
You can even prefetch popular libraries: https://crates.io/crates/cargo-prefetch
And you can likely mention it as an explicit dependency in your csproj so that you can download it on first restore.
Also, when you write something on those environments, you know users cannot install a runtime. So you get in touch with IT teams to ensure which version of runtime they are deploying. If and only if you have to update it for proper reasons, then they can deploy newer versions to the clients. For all or for a specific user base. This is how it works.
Without an actual business case or a security concern, you don't just go from a runtime to another, let's say 4.8 to 6.0. So yes, development in airgapped environments is PITA. But it's the same with Java, Python, Perl, etc. That's not the fault of the runtime but the development environment itself.
That's exactly what you have to do here.
I understand OC issues with the difficulties associated with using M$ tools with limited internet but wonder if the "Air Gapped" example may be a bit extreme.
Being required to work from home while still meeting an employers' secure network policies might be more common.
The end result is a Golang-like, single binary experience that runs on many platforms easily and rapidly.
Though I can master a lot of programming languages, I miss C# the most especially on async/await and LINQ. Rust is what I'm favourited in second places with a lot of similarities of C#.
[1]: https://docs.microsoft.com/en-us/dotnet/core/deploying/singl...
But to this day, nobody knows what data your system telemetries to Microsoft. Not the data they talk about in the 5-10 page license. Instead, the data mentioned in the 55 page doc about what you agree to send them, that they refer to from the MS Software License...
Like every other dev system, connect, either download offline installers for everything (they exist), or get your system running, then you can dev offline all you like.
You don't need to "be connected to the internet at all times for any reason whatsoever". You need it once.
What I miss is the old model for installing software. Give me the yearly ISO, optionally provide a service pack or two if some huge problem went under the radar in testing.
If you don't want it to download anything then you use the `dotnet publish --no-restore` flag, which is used a lot in CI/CD pipelines. If you don't have the package dependencies cached it will then simply fail.
The internet exists, the industry has evolved, software has dependencies, and yes you have to download them (just like you had to download the SDK ISOs back in the day). But it's just one command, run it and get it over with, and after that up-front one-time pain you'll have a nice offline workflow.
That is easily doable. However users often don't want a copy of a large runtime for each and every program they use, so it often makes sense to move common things (like DLLs, runtimes, your OS) to libraries that can be shared.
You can easily make dotnet apps in either flavor to your liking. And not every developer is going to make their apps to appeal the your needs.
In days gone by we used to have truly standard libraries and runtimes, in the sense that they came with your build tools out of the box and so were available everywhere. Host platforms similarly provided basic services universally. Documentation was often excellent and also available out of the box.
In that environment, writing "Hello, world!" meant writing one line that said do that, maybe with a little boilerplate around it depending on your language. Running a single simple command from a shell then either interpreted your program immediately or compiled it to a single self-contained executable file that you could run immediately. Introducing external dependencies was something you did carefully and rarely (by today's standards) when you had a specific need and the external resource was the best way to meet that need.
Some things about software development were better in those days. Having limited functionality in standard libraries and then relying on package managers and build tools where the norm is transitively installing numerous dependencies just to implement basic and widely useful functionality is not an improvement. The need for frameworks and scaffolding tools because otherwise you can spend several hours just writing the boilerplate and setting up your infrastructure is not an improvement.
Microsoft could do a much better job onboarding new developers.
Hell just recently they were trying to take away hot reload to keep that feature as a paid feature only part of VS
The fact this edition exists does not change my point, or really add anything of value to the conversation
I only really started liking .NET when I stopped using visual studio a few years ago.
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/ since that has the WPF designer in (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?
- 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
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?
Because that's how it works for very every single interpreted and bytecode compiled language?
And the thing that changed in the early 2000s was a massive shift toward using interpreted and bytecode compiled languages.
If we're specifically talking .NET, the thing that changed since the early 2000s is that creating a self-contained executable became possible in the first place. On Windows, .NET *.exe files were still run by an outside runtime, it's just that, since Microsoft owned the whole platform, it was easy for them to hide all that behind a curtain, ensure .NET is preinstalled with Windows, etc. The design constraints changed when .NET became cross-platform. OS X and Linux require a bit more (or at least different) finagling in order to achieve good user experience.
I went ahead and searched for C# executable around 2005-2006. Guess what, this wasn't even a question then. Because, apparently, building an .exe was also the default setting for C# projects in Visual Studio.
So. What changed?
> If we're specifically talking .NET, the thing that changed since the early 2000s is that creating a self-contained executable became possible in the first place.
It was always possible.
> On Windows, .NET .exe files were still run by an outside runtime
1. We're literally in the thread to a question about Windows apps. On Windows
2. If you've ever did anything on Windows such as played a game, you'd know that you almost always need something external to run: be it msvcrt (c++ runtime) or clr.
> The design constraints changed when .NET became cross-platform.
What you mean is: it's still perfectly fine to create a standalone executable, but for some reason it's now called a "more advanced operation". The thing that's changed is that now it's hidden behind a ton of inconsistently named parameters
They were much more comparable to an "executable" Python or Perl script where the OS knows to look at the hash-bang line to figure out what interpreter to use to run it. If you try to execute one of those .NET .exes on a computer that doesn't have a suitable .NET run-time installed, you'll get more-or-less the same error as you'd get trying to run a Python script on a computer that doesn't have Python installed.
The part that was being criticized a few comments up was about how to create self-contained .NET apps with the runtime bundled in and everything. Specifically, these guys: https://docs.microsoft.com/en-us/dotnet/core/deploying/#publ... That kind of executable simply did not exist in the old Windows-only .NET Framework; it's a feature that was first introduced in .NET Core 3.0.
Also please dont lump interpreted languages with C#. At least with interpreted languages, once you have the runtime on your computer, you can have a single script file to work with. With C#, you STILL have to have the runtime on your computer, then after you "compile", youre left with a folder of one EXE and literally over 100 DLL.
The main difference is that Python installs them globally (or at least thinks it does, if you're using virtual environments), while .NET apps isolate themselves from each other.
Also, let's make a fair comparison. Is that hypothetical Rust application of yours depending on literally 100 crates? If so, what is the size of your binary?
No you don't. If you'd rather increase the download size for the user then you can turn on self-contained (include runtime) and single-file app.
1. Build it runtime dependent: ( which requires the NET 6 runtime to be pre installed ) on your computer in order to be able to run: You get a single exe file.
2. Build it self contained: You get a directory with a bunch of dlls and one exe But no runtime needs to be installed on the target computer
3. Build it self contained + single exe: You a get a single exe that embeds all those dlls and unpacks them in memory ( since net 6, in net 5 it would copy them to a temp directory )
4. Build it using AOT Mode: You get a single, statically linked exe. This is probably the closest to a standard Rust (statically linked) build. However AOT mode is not yet official and requires some fiddling still, but should become stable for NET 7 next year. And you loose out on some features obviously like runtime code generation
The Python people stuck in venv hell would probably think otherwise.
That means that by default you can't do tree shaking, which means you would end up with enormous exes, which will probably annoy the type of people who want a single exe.
The bit more advanced is to tell the compiler which types you might want to reference by reflection so that it can shake the rest out of the tree.
The old Delphi-based version of Skype fell into that category. Thinking of that example, I can understand why some people think modern software is decadent.
Short story: developer interests unfortunately don't always align with tool builder interests.
It's really easy/simple to change an application to adjust for a different client this way.
I'm not sure I know any frameworks that easily support arbitrary native .dll/.so inside the application executable.
Strategic decision from Sun and Microsoft that has crippled software for 2 decades already.
The C# team says "this is the new best practice" while VS still drives you to The Old Way all the time.
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.
Full disclosure: I know what I am talking about
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.
Isn't WPF getting phased out tho?
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