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

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

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 .

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

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.

How to take care of the application before or after .Net framework upgrade in Azure App service

I have few applications developed using different .Net framework and deployed in Azure app service as web app and function app.
The applications developed using Visual Studio 2013 ( I think, .net 4.5.1) and Visual Studio 2019 (.Net 4.6) and deployed in Azure. The application type is ASP.Net MVC, Web app using .Net core and Azure function app.
Very recently MS announced that they are upgrading the .Net framework in Azure App service ( or basically in Azure platform). I think, Which is going to effect after 14 July 2020.
My Questions are, [considering very less time we have and applications are developed in old versions of Visual Studios] ;
will all these application work perfectly in Azure app service, after MS upgrade the framework?
I hope, the old versions of the .Net framework will still be exists in Azure/Azure app service along with the newly .Net versions?
The development PC does not have .net 4.8 version installed, installing, upgrading application's framework and testing the applications in very less time is quite impossible, is there any quick ways to do testing of entire application?
Is there any chance that application functionality will not work during this upgrade and there will be a downtime? Any one faced similar issues?
These applications are interaction with other enterprise application, what actions to be taken care?
Is there any step by steps guideline given by Microsoft those needs to followed?
Is there anyone facing similar issues? What is the best practice/ways to manage this in very less time ? Please let me know. Thanks
This is the announcement:
https://azure.github.io/AppService/2020/06/09/NET-Framework-4.8-is-coming-to-App-Service.html
The .NET Framework 4.8 update is a non-breaking in-place upgrade on App Service. No updates are required to existing applications.
All frameworks are installed, so you will have no issues. There should not be an extra amount of downtime for the upgrade.

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.

Install (activate) .NET 3.0 Framework with an application in Vista

if i have an application that requires .net 3.0, what is the proper way to make an install file out of it, that will install the application and then install (activate) the .net 3.0? i tried publishing my project through visual studio 2008 (c#) which created the installer and the .net activator, but it didn't work properly on computers other than my own, when the .net 3.0 was not present.
i though i could bundle http://www.microsoft.com/downloads/details.aspx?FamilyID=10CC340B-F857-4A14-83F5-25634C3BF043&displaylang=en with the application, which would download and install .net 3.0 if needed. this could work ok on non-vista systems, but on vista, the redist package reports an error: you must use turn windows features on or off in the control panel to install or configure microsoft .net framework 3.0
The key is to install the .net framework if it is not there - regardless of the OS. Also, just go ahead and install the .Net 3.5 framework if you are going to install one of them.
Anyway, if you are using the built in installer that comes with Visual Studio, this is a real pain in the butt. You would be better off, and saner if you went with a different installer package. Install Shield, Wise, InstallAware will all do it for you. I believe you can also find better guidance on how to do this with Wix and NullSoft Installer.
http://www.improve.dk/blog/2007/06/10/creating-a-dotnet-bootstrapped-installer-using-nsis
How can I detect .NET 3.5 in WiX?
Windows Vista has already .NET Framework 3.0 installed.
Now if you wanted for example to have .NET Framework 3.5 installed you could create a Setup Project and then right click and go to View->Launch Conditions. There will be a .NET Framework launch condition where you can specify the required version of the framework and an URL to download from.
Here's a post about Launch Conditions in a Setup Project.

Categories