5
votes

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.

4
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.Jerry Liu
removing did it for me.BrilBroeder
Removing the folder fixed the issue for me tooRyan Spears

4 Answers

2
votes

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

6
votes

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

2
votes

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.

2
votes

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/