Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error publishing .NET Core 2.0 web application to Azure App Service

I recently upgraded my Visual Studio 2017 Community Edition from version 15.6.2 to 15.6.3 and since then I have not been able to successfully deploy my .NET Core 2.0 web application to my Azure App Services using an existing Publishing Profile.

The error messages is 'C:\Program Files\dotnet\sdk\2.1.102\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5): Error : Assets file '\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0'. Ensure that restore has run and that you have included 'netcoreapp2.0' in the TargetFrameworks for your project.'

I have tried:

  • Re-downloaded new Package Profiles and then rebuilding and publishing.
  • Deleting the project.assets.json file from \obj\ folder, rebuilding the publishing.
  • Changing the Target Framework in Project Properties from .NET Core 2.0 to another framework and back again, rebuilding and publishing.

None of the above resulted in a successful deployment and I kept getting the same error message.

I also examined the project.assets.json file and the target is ".NETCoreApp,Version=v2.0".

I ran 'dotnet restore', 'dotnet build' and 'dotnet deploy', all of which succeeded.

like image 413
Ryan Spears Avatar asked Mar 21 '18 03:03

Ryan Spears


People also ask

How do I deploy a web application to Azure App Service?

To deploy to any Azure App service (Web app for Windows, Linux, container, Function app or web jobs), use the Azure App Service Deploy task. This task is automatically added to the release pipeline when you select one of the prebuilt deployment templates for Azure App Service deployment.


1 Answers

I resolved a similar issue by creating a new Publish Profile. It worked for me. Please give a try.

like image 185
vijeesh chandran Avatar answered Nov 15 '22 04:11

vijeesh chandran