Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio project.json does not have a runtime section

I ran into a error in visual studio 2017, I'm searching over the net but I don't find anything usefull, so my question is, how can I solve this:

Severity Code Description Project File Line Suppression State Error Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore.

I was seaching for file where is located in my project but with no succsess.

Thanks

like image 448
Andrej Avatar asked Aug 10 '17 12:08

Andrej


2 Answers

I got rid of this problem by manually deleting Visual Studio obj folder of the project that it's complaining about (the 'Clean Solution' command wasn't getting rid of it). I found the answer through this and this threads.

like image 193
neruam23 Avatar answered Nov 06 '22 07:11

neruam23


I had the same issue after trying to migrate all my projects to the new .csproj format manually. I had an issue with one projet in the new format, so I reverted from git, and this message started to show up.

What I did:

  • Closed VS
  • Removed the .vs folder
  • Removed the packages folder
  • Restarted VS
  • Tried to build
  • Had issues with namespaces not found, as if packages were not installed
  • Opened NuGet package manager console
  • Ran Update-Package -reinstall -ProjectName <project>

Problem gone!

Hope it helps someone with the same issue :)

like image 2
cube45 Avatar answered Nov 06 '22 07:11

cube45