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

4

5

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.

Orabelle answered 21/3, 2018 at 3:42 Comment(3)
You can remove "C:\Program Files\dotnet\sdk\2.1.102" and try to publish again. Or if you have installed ReSharper plug-in, try to use ReSharper build, set ReSharper build: ReSharper-> Tools -> Build & Run.Grig
removing did it for me.Earleenearlene
Removing the folder fixed the issue for me tooOrabelle
B
2

I had the same problem with the publishing and a local build.

The developer community has a discussion about this https://developercommunity.visualstudio.com/content/problem/218674/assets-file-cxxxxxxobjprojectassetsjson-doesnt-hav.html

Resharper and MS people found the problem and promised to fix it soon...

For now, deletion of the sdk\2.1.102 and the restart solved my problems

Berenice answered 21/3, 2018 at 23:28 Comment(0)
M
7

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

Morpheus answered 6/6, 2018 at 6:55 Comment(1)
Had the same thing. The Visual Studio 2019 UI showed 'netcoreapp3.1' but my pubxml file still had 'netcoreapp2.1' in it. So ot showed 3.1 but still used 2.1Monitor
B
2

I had the same problem with the publishing and a local build.

The developer community has a discussion about this https://developercommunity.visualstudio.com/content/problem/218674/assets-file-cxxxxxxobjprojectassetsjson-doesnt-hav.html

Resharper and MS people found the problem and promised to fix it soon...

For now, deletion of the sdk\2.1.102 and the restart solved my problems

Berenice answered 21/3, 2018 at 23:28 Comment(0)
O
2

I fixed the issue by deleting the sdk\2.1.102 folder as suggested by @NikolaiT and @Jerry Liu.

I also found that the issue was fixed by upgrading to Visual Studio 2017 verion 15.6.4, as a new sdk was installed. The new sdk version was 2.1.103.

Orabelle answered 23/3, 2018 at 2:41 Comment(1)
Thanks for your sharing :).Musty
L
2

The problem is fixed in ReSharper 2017.3.5, everything works with all combinations of Visual Studio and .NET Core SDK. You can find more technical details in the official blog post: https://blog.jetbrains.com/dotnet/2018/03/23/build-failures-visual-studio-15-6-3-resharper-ultimate-2017-3-5-rescue/

Lulululuabourg answered 23/3, 2018 at 23:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.