Posts

Showing posts from December, 2019

Migrate Azure Function app from .NET Core v2 to v3

For migrating an Azure Function app from .NET Core v2 to v3 follow the following steps Unload the Azure function project by right clicking the project and selecting unload. Change   <propertygroup>    <targetframework>netcoreapp2.2</targetframework>    <azurefunctionsversion>v2</azurefunctionsversion>   </propertygroup>           to   <propertygroup>     <targetframework>netcoreapp3.1</targetframework>     <azurefunctionsversion>v3</azurefunctionsversion>   </propertygroup> Reload the Azure function project by right clicking the unloaded project Update the Microsoft.NET.Sdk.Functions nuget package to version 3.0.2 or higher Update the Microsoft.Azure.WebJobs.Extensions (when installed) to version 4.0.0 or higher In the local.settings.json change the FUNCTIONS_EXTENSION_VERSION setting to "~3" When I for the first time tried to start the converted Azure function project I got the m

Migrate .NET Core v2 MVC app to v3

For migrating your .NET Core v2 MVC app to v3 use the following steps Change the .NET Core version of your web app to .NET Core v3.1 or higher Change your Startup.cs in your web root Remove the following line services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); Add the following line to the ConfigureServices method services.AddControllersWithViews(); Change the signature of method from public void Configure(IApplicationBuilder app, IHostingEnvironment env) to public void Configure(IApplicationBuilder app, IWebHostEnvironment env) If you use a env.IsDevelopment() statement add the following in the top of your Startup.cs using Microsoft.Extensions.Hosting; Add the following lines to the bottom of your Configure method app.UseRouting(); app.UseCors(); Only add the following lines if you use authentication / authorization app.UseAuthentication(); app.UseAuthorization(); Convert your web routes from app.UseMvc(routes => {          routes.MapRoute(