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.
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
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.
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/
I resolved a similar issue by creating a new Publish Profile. It worked for me. Please give a try.