Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore.
2017-11-28T02:43:50.4396191Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet15.0\Microsoft.NuGet.targets(178,5): 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.
2017-11-28T02:43:50.4396191Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet15.0\Microsoft.NuGet.targets(178,5): 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. [F:_agent_work\7\s\src\test*.Api.Tests.Functional*.Tests.Functional.csproj]
I have resolved the issue. I have to change the project build template. There was a migration from project.json to csproj (VS2015 to VS2017) but that was going fine for quite some time now but some how it started breaking recently.
I changed the project build template as below:
```xml
I'm hitting this same issue. Builds have been working just fine but during the past two weeks something has changed which has made this issue appear. Upgrading to new CSPROJ format fixes it but for some of our projects that is not an option as they contain Entity Framework edmx files.
Here's the logs
```
6>EntityDeployNonEmbeddedResources:
Skipping target "EntityDeployNonEmbeddedResources" because it has no outputs.
EntityDeployEmbeddedResources:
Processing 1 EDMX files.
Starting to process input file 'Model1.edmx'.
10>EntityDeployEmbeddedResources:
Finished processing input file 'Model2.edmx'.
Finished processing 1 EDMX files.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\NuGet15.0\Microsoft.NuGet.targets(186,5): 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.
````
All of a sudden I had this error even when using the old (non-sdk) project format for a f# project.
References didn't show up even though the project file included them. Cleaning bin and obj folders helped. Just in case someone stumbles on the same problem. Very weird.
To me this happened when I tried to port a project from the old to the new csproj format. New was not working well, then I reverted changes back to the old format. Then this issue started happening.
.vs
folder: no availbin
and obj
: no avail.csproj.user
file: fixed.Maybe one, or both of the previous two attempts were a prerequisite (but not sufficient) to address the issue, but I can't say for sure. At least deleting the obj
folder should be necessary, I guess. Good to keep this in mind while migrating projects from old to new format, specially on git repositories. One may switch back to an older release (as you hopefully don't track the .user files and obj folder), and see a breaking build that shouldn't be there.
I had the same issue today. Then I found this post:MSBuild Your project.json doesn't have a runtimes section
And adding the following section solved my problem:
<PropertyGroup>
<RuntimeIdentifiers>win;osx.10.11-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
</PropertyGroup>
Funnily enough, _removing_ the <RuntimeIdentifier>
from a troublesome project resolved this issue - in VS, at least, but not via MSBuild on our build server.
In my case, I had (clearly created from an old Windows 7 machine):
<PropertyGroup>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
For me, I had a projects.assets.json
generated in the obj/
directory, cleaning that out resolved the issue. Anyone know the root of this problem?
@shurane Your solution fixed it for me too.
Yes, it seems to be the projects.assets.json
file that is causing the problem. If you have a large amount of sub-projects, you can use rm -rf ./**/*/obj
in the solution dir to delete all the obj folders
For me I've been unable to resolve it as of yet, cleaning bin/obj didn't remove the error. For me it only happens using msbuild and does not occur using VS2017.
this SO answer helped to fix the issue https://stackoverflow.com/a/36211569/173613.
Closing this as it's not a bug with the build tasks. Please see the SO answer shared above this comment.
Most helpful comment
All of a sudden I had this error even when using the old (non-sdk) project format for a f# project.
References didn't show up even though the project file included them. Cleaning bin and obj folders helped. Just in case someone stumbles on the same problem. Very weird.