Does UWP need .NET/.NET Core To Run On Client? - c#

I have looked for this everywhere but cannot understand what to do.
I understand that UWP apps need their dependencies installed, but do they also need .Net/.Net Core installed on the client machine?
What I am doing:
Using another UWP app and the PackageManager class, I am making my own installer. (UWP installs UWP)
So I know I will have to install the dependencies (appx files) too, but do I also have to make sure that .Net/.Net Core is installed? Thanks!

but do they also need .Net/.Net Core installed on the client machine?
No. A UWP app targets a natively implemented SDK version that doesn't have any dependency on .NET Core.
The C# language projection is indeed based on .NET but the CoreCLR (.NET Core runtime) is not used at runtime so you don't have to install any addtional .NET stuff on the client machines where your UWP app is run.

Related

.NET Desktop Runtime is required before installation

I've developed an application in .NET 5.0, also, I've a Setup Project to install this application in my clients.
My steps are:
1.- Publish the .NET 5.0 Application.
2.- Compile the Setup project.
3.- Install the setup.exe generated in "2" in the client.
But when I try to install the program in my client, windows says "This installation requires the 5.0.0(x64) version of .NET Desktop Runtime... So I've to download and install the SDK in every client.
My question is: There is some way to avoid this SDK installation? Can I embeed the .NET Desktop Runtime in the .NET 5.0 App or in the Setup Project?
Thanks in advance.
See .NET application publishing overview, specifically publishing a self-contained application. That way all necessary framework files will be included in your application, and you will not the framework to be installed. This will increase the disk requirement a bit if .Net 5 is already installed, since some files will be duplicated.
The alternative is to bundle the the .Net framework installer in your installation script. This will cause the setup-file to be quite a bit larger, unless the script downloads the framework on demand. But it may save some disk space in case there are multiple applications that use .Net 5.
Go on projet Menu/ projetct properties / publish / require components / uncheck you frameWork .

How to Pick which Framework Version to Build app for C# Visualstudio

I am very new to C# development. Like Youtube tutorial new. I am trying to build a console app to install services to our servers. Is there a way to pick which .Net version you want to use to build the application? So that I the writer can tell the user which .Net version they should have in their system for the console app to run?
I am using Visual Studio 2019
Thanks to #David Browne's comment under my original post all you need to do is make sure to select .Net Framework version of the Console Application template in Visual Studio project template. Not .Net Core. I wasn't aware there was a difference:
"You set the Target Framework in the Project Properties. But the Project Type determines whether you're targeting .NET Framework or .NET Core"
You have 2 options to get started
.NET Framework - Apps build using .NET framework can only run on Windows. This is an years old proven and secure stable, mature eco system
.NET Core - Apps build using .NET Core can run on Windows, Linux and Mac. It's cross platform and open source. Latest is v5.0.
I recommend you to use the latest .NET Core v5 for your new projects. It's stable and Microsoft is well supporting it. .NET Core much is powerful, faster and optimized.
You can create different kinds of apps using .NET Core. You can create simple console apps, libraries or asp.net core web apps. MVC and WebAPI are supported. As you mentioned, if you want to create a service, There is "Worker Service" project available for .NET Core.
If you create a Worker Service it can run as a Windows Service in Windows machines and a Linux Deamon in Linux machines.
Visual Studio 2019 got well with .NET Core and it's features.
If you need to run a .NET Core project in Windows, Linux or Mac machine, you also need to setup the deployment machine installed with .NET Core runtime. It's available free from Microsoft website. Download.. Install.. Run. That simple

Is possible to deploy a self contained .NET Framework application?

I'm developing a C#.Net application that uses the .Net Framework but I'm having trouble when users are installing the application on their computers. Some of them just don't know how to install the .Net Framework.
I'm searching for a solution to this problem and I found the self contained deployment use in .Net Core applications.
The problem is that my application doesn't use .Net Core, it is a WPF application.
I already search the web and all solutions I find brings me to the .Net Core self contained deployment.
What can be done in order to deploy a "self contained" .Net Framework application?
Thanks in advance.
You can use WiX to create a "bootstrap" installer, which will install required frameworks before installing your application.
http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html
Find a version of the .NET Framework that all of your target computers already have, and set Visual Studio to target that version of the framework.
Then, just copy/paste all of the files out of the bin/release folder into a folder on the target computer and run your program's executable.
If all of your target computers have Windows 10, you can deploy using version 4.6 of the framework, and be guaranteed that your clients already have it.

Use local .NET Core system libraries instead of adding them to every package

Our client has complained about the count of .dll files in the .NET Core app we made for them. Their dissatisfaction persists even after we explained that this is how .NET Core works.
Now I do understand their position completely, my jaw dropped too when I created the package for the first time:
Note how small the scroll bar is. Most of the library names begin with Microsoft. or System. - those that don't are libraries that I use and installed manually.
So the question is: is there anything I can do about this to make our client happy? Aren't the System.* libraries already installed on their machine as a part of .NET Core runtime?
We're targeting .NET Core 1.0 at this moment.
You can create two types of deployments for .NET Core applications:
Framework-dependent deployment
Self-contained deployment
It seems you need Framework-dependent deployments (FDD).
Portable (FDD) application is similar to the traditional .NET Framework application. In this case, a certain version of the .NET Core Framework (also known as shared framework, .NET Core Runtime, redist) should be on the target computer, and when the host starts, the process will load Core CLR, Core FX from the frame folder.
Artifacts of the same Portable Application for different versions of the .NET Core platform
You can see what Directory structure of published ASP.NET Core apps should be
To run Portable applications, at least one .NET Core Runtime (shared framework) must be installed on the target machine. The framework files (s) are stored in the C:\Program Files\dotnet\shared folder.
Core is designed to do this. In old .NET Framework apps, there's a runtime dependency on .NET Framework, i.e. the end-user must have the version of the .NET Framework the application targets installed on the machine as well. Core takes a different approach; it brings everything it needs into the build. As a result, you can drop this folder on any machine, no matter how it's set up and "run" it. (Now technically, you need dotnet.exe in order to run it, unless you build as an executable, but that's just to run the main app DLL.)
Anyways, this is by design, and it's actually much better when you think about it. Your app has just the dependencies it actually needs and nothing else. You don't have to worry about external things like what version of .NET Framework is installed, etc.
That said, I know there's some third-party applications (mostly commercial) that can enable you to "bundle" DLLs or even package up everything into a single executable. However, I'm not sure how compatible, if at all, these are with .NET Core. Still, if your client insists, I'd just see if you can find some tool that does that and essentially "hide" the DLLs.

Deploy .NET winforms application packaged with .Net Framework

I have a Winforms application developed in c# targetting .Net Framework 4.0. I created a setup for the application and packaged the .Net Framework 4.0 within the setup. During installation, the setup installs the .Net Framework 4.0 (if not installed already), and the application works fine.
I know it's not possible to run .Net application without .Net Framework. Is there some way I can package the CLR, JIT, and all required dll's with my application so that I won't need to install the entire .Net Framework 4.0 on the target machine?
Can i create my own installer for .Net Framework 4.0? Installer which insalls only the libraries which are required for my application, thus eliminating the need to install entire .Net Framework?
I have looked into ngen, Turbo Studio etc. to containerize the application but that does not suit for my purpose. Any help will be highly appreciated.
The .NET Framework was not designed to be deployed partially. I don't think this is possible - even if you will get that to work, it won't be supported officially. You might even see that your app is running but it might crash at any time later as soon as an assembly gets referenced (lazy by reflection, for example) you have no direct reference to.
Having only those parts of the framework deployed which are directly or indirectly referenced by your app is one of the main ideas of .NET Core - but you won't be able to do full-featured UIs with it by now.

Categories