Azure pipelines - AzureFunctionApp#1 - .NET 7 - c#

I upgraded my azure function to .NET 7. But the azure pipeline task I was running to deploy the code, AzureFunctionApp#1, doesn't give .NET 7 as an option when using a linux consumption plan.
I guess I have to use the CLI to deploy the code for now then?

Related

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

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.

What is the correct order of installation for running a DotNet Core web application on a local IIS server?

I run a local IIS Server with a DotNot Core 2.1 application deployed to it. I like to keep up to date with the latest security patches that are released monthly and I use the Core download page to do so.
My question is, what ALL do I need to install each time and in what order. I usually find a Framework installer and I chose the SDK just to make I have everything. Then I find a ASPNET.CORE installer and I run those in. Finally, I run the Web Hosting Bundle.
Am I doing too much? Do some of these items copy over the same assets? What is the correct proceedure?
If you need to host an asp.net core web app, follow the Host ASP.NET Core on Windows with IIS Guide.
In terms of installing things, follow the Install the .NET Core Hosting Bundle Section
The bundle will install 3 things:
.NET Core Runtime
.NET Core Library
ASP.NET Core Module (for IIS)

Run ASP.NET application on Linux

I am trying to run an application made in .NET Framework 4.5 (Windows) in a Linux environment (Centos7).
I have tried with mono and xsp4 but I have the following doubts:
Mono and xsp4 are the best applications to execute a code in .Net?
Should I compile the * .cs first in linux?
Can I run the publish folder generated in windows directly in Linux
(if so)?
I can run an application made in .net in asp.net
regards
Applications written for the standard .NET framework will not run in Linux; you can try to run them in Mono but it has a number of restrictions in terms of what it supports. If you want to guarantee support it would probably be better to compile your app with Monodevelop so it will compile against that runtime. It is also the "old" way of doing this.
What you should be doing is targeting .NET Core; which is designed to run on other operating systems (including a number of Linux distributions). When you do that you would add a runtime identifier for your distro and publish to it; generating binaries that will run with the dotnet command on that platform.
Note that when using .NET Core in production you need to set up a reverse proxy to a "production ready" webserver like IIS, Apache, or Nginx as those are hardened against attacks the Kestrel server still is not.

Where to configure Razor page language version to C# 6?

Recently I've tried to use some C# 6 new feature (interpolated strings) in my ASP.NET MVC (5) .cshtml view, but when running got an error message complaining about the $. It is clear the compiler in C# 5 compatibility mode, or worst it is a C# 5 compiler.
When in editor a popup warning warns me (I do not know it is VS or ReSharper) Feature 'Interpolated strings' is not available in C# 5. Please use language version 6 or greater.
The project itself was set to C# 6, and I can use C# 6 features in my build time compiled code like controllers etc.
Q: Where should I set page compiler version, and will this C# 6 compiler available when I deploy my web app to Azure there?
From String interpolation in a Razor view?:
This only works in MVC6. Alternatively, also from a comment on this link, you'll need to add the roslyn code dom package from ASP.Net.
<div>
#($"Hello {this.Model.SomeProperty}")
</div>
As far as Azure is concerned, please see this link. http://azure.microsoft.com/blog/2015/08/11/update-on-net-framework-4-6-and-azure/
With great power… The tooling, framework and Azure platform teams want
to ensure the powerful tools we give you to help build your dream is
matched by the responsibility we recognize we have to keep it running
in the cloud. At the time of the Visual Studio and Azure SDK 2.7
releases, Framework 4.6 wasn’t supported broadly throughout Azure.
This is due in large part to the fact that just as many teams (or
more) are responsible for the ongoing development and stability of the
Azure platform.
For now, we have an update on the availability of .NET Framework 4.6
for Azure App Service and an article demonstrating how to get .NET
Framework 4.6 working in your Cloud Service roles.
Azure IaaS
For customers using Azure’s Infrastructure as a Service
(IaaS) services, installation of .NET Framework 4.6 is manual. To
install .NET Framework 4.6 on an Azure IaaS virtual machine, the
process is as simple as logging into the virtual machine using Remote
Desktop. Once on the machine, the .NET Framework 4.6 installer can be
downloaded and installed directly onto the virtual machine. Customers
using Azure Automation could also choose to automate the installation
onto Azure virtual machines using PowerShell.
Azure App Service
Update The Azure App Service team is nearing the end
of the testing phase for .NET Framework 4.6 and planning the
deployment to the environments. Currently, the plan is to roll out the
updates to Azure App Service during August 2015.
Azure Cloud Services
Saurabh Bhatia authored an article in the Azure
documentation center outlining how to install the .NET Framework in a
Cloud Service Role. The content has been recently updated to include
commentary specific to .NET Framework 4.6. You can find the updated
article here on the Azure documentation center.
For me installing the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package solved the problem.

Categories