'Cannot publish web app to Azure on .,net 6
I have a Razor Pages project running on Azure web app service on Linux on .net 5. I have been using zip deployment to publish it without any problems. Now I want to upgrade to .net 6, so I have changed the .net version for the project, updated the nuget packages from 5 to v6, changed the target version in Azure to 6, changed the target version in the publish profile to v6, but whenever I try to publish it fails every time.
I have followed the required steps as outlined here
If I roll the entityframeworkcore packages back to v5 then it publishes ok. What am I doing wrong?
The publish profile is framework-dependent. The only error message I get on publish is:
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
=================== C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.ZipDeploy.targets(55,5): Error : Zip Deployment failed. 3>Build failed. Check the Output window for more details. ========== Build: 2 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
Solution 1:[1]
We have tried the same to Migrate our .net5 ASP.net core project to .net6 and publish to Azure successfully .
To do that as you are following the Correct MICROSOFT DOCUMENTATION
Make sure that after adding .net6 and update all the packages you have restart the application .Or close or reopen and then try to build again.
We have added the following to our application.
Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>aspnet-convert5to6ajay-F19DC718-9xxx-4xx4-8E14-xxxx</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.3" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.23.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.23.0" /> //add below packages as you have entityframework
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.0" />
<PackageReference Include=Microsoft.Extensions.Caching.Abstractions" Version="6.0.0."
/>
</ItemGroup>
</Project>
And in appsettings.json add below
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Aspnetcore": "Warning"
}
},
"AllowedHosts": "*"
Then restart the application and then build and publish to Azure
For more information please refer this Blog
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AjayKumarGhose-MT |




