Fixing missing project.json error in old csproj format

When moving between old and new csproj formats, and back again when it doesn’t work, I have several times ended with a project.json error looking like this:

project.json error message


The cause comes from left over files in your obj catalogues.  The file in question seems to be named project.assets.json.

Deleting these in all subfolders seems to do the trick.

Run, from the root of your repo:

del project.assets.json /s /q


[The below didn’t always work]

And whatever I do to get rid of it, clearing caches and more, nothing seems to help  once it appears, until I stumbled over this cute little trick:

For the project which are affected, add the following snippet into your csproj file.


Ref: Source of fix:  Emgarten’s comment on this Nuget issue