project-system: "Assets file '...' 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." after upgrading to VS 15.6.3

Since updating VS 15.6.2 to 15.6.3 I started receiving the following error after modifying a source file and rebuilding the solution:

12>C:\Program Files\dotnet\sdk\2.1.102\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5): error : Assets file 'C:\W ork\engine\engine\Loop54.Webserver\obj\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.
12>Done building project "Loop54.Webserver.csproj" -- FAILED.
12>C:\Program Files\dotnet\sdk\2.1.102\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5): error : Assets file 'C:\W ork\engine\engine\FSharpModules\obj\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.
12>Done building project "FSharpModules.fsproj" -- FAILED.

That is, the solution initially builds successfully, but if I a change a C# source file and try to build it again the error occurs (every time). If I clean the solution it then builds successfully again.

It doesn’t complain about the project I modified, but about 2 of its (indirect dependencies). I also tried modifying other projects and got the same error about some other projects that those depend on, e.g.

7>------ Build started: Project: CSharpSpellmasters, Configuration: Debug Any CPU ------
7>C:\Program Files\dotnet\sdk\2.1.102\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5): error : Assets file 'C:\W ork\engine\engine\Loop54.Engine.Core\obj\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.
7>Done building project "Loop54.Engine.Core.csproj" -- FAILED.

I’ve verified that project.assets.json does have a target for ‘.NETCoreApp,Version=v2.0’ and also its contents are the same as after a clean (when the build succeeds). I don’t have a duplicate ProjectReference as far as I can see or anything else weird. I tried going back to an earlier revision of the code and it still happened there.

The only recent change was upgrading to 15.6.3. I re-installed VS 15.5.7 (which was a huge waste of time!) based on https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 and the problem disappeared.

Is there a way I can upgrade to 15.6.2, at least? (15.5.7 has another problem I ran into, that was fixed in 15.6.) Can I install an “experimental” version of VS in parallel with my main (stable) one? This waste of time due to what is probably a simple bug is an AWFUL user experience. With almost any other software I’d be able to simply go back to the old version in a few minutes.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 18 (7 by maintainers)

Most upvoted comments

This issue was fixed in 15.6.4 which was released on Friday, as indicated in the primary issue.

Mine isn’t even multi-target, I have <TargetFramework>netcoreapp2.0</TargetFramework> for all projects.