Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project.json doesn't have a runtimes section, add '“runtimes”: { “win”: { } }' to project.json #5931

Closed
PrasadSudama opened this Issue Nov 28, 2017 · 13 comments

Comments

Projects
None yet
@PrasadSudama
Copy link

PrasadSudama commented Nov 28, 2017

Environment

  • Server - VSTS
  • Agent - Private:

Issue Description

Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore.

Error logs

2017-11-28T02:43:50.4396191Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.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\NuGet\15.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]

@PrasadSudama

This comment has been minimized.

Copy link
Author

PrasadSudama commented Nov 28, 2017

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:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
    <RuntimeIdentifier>x64</RuntimeIdentifier>
    <AssemblyName>SomeAPI.Api.Tests.Functional</AssemblyName>
    <PackageId>SomeAPI.Api.Tests.Functional</PackageId>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
</Project>
@pekkah

This comment has been minimized.

Copy link

pekkah commented Jan 12, 2018

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.

@pekkah

This comment has been minimized.

Copy link

pekkah commented Jan 12, 2018

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\NuGet\15.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.
@HeinzmeierDornbuschFeldhausen

This comment has been minimized.

Copy link

HeinzmeierDornbuschFeldhausen commented Jan 23, 2018

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.

@fabriciomurta

This comment has been minimized.

Copy link

fabriciomurta commented Apr 6, 2018

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.

  • Remove solution root's .vs folder: no avail
  • Remove project's bin and obj: no avail
  • Remove projects .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.

@huanlin

This comment has been minimized.

Copy link

huanlin commented Apr 15, 2018

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>
@nullpainter

This comment has been minimized.

Copy link

nullpainter commented Apr 18, 2018

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>
@shurane

This comment has been minimized.

Copy link
Member

shurane commented May 21, 2018

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?

@misterspeedy

This comment has been minimized.

Copy link

misterspeedy commented Jun 13, 2018

@shurane Your solution fixed it for me too.

@ConnorChristie

This comment has been minimized.

Copy link

ConnorChristie commented Jul 30, 2018

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

@replaysMike

This comment has been minimized.

Copy link

replaysMike commented Aug 2, 2018

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.

@rajkishor09

This comment has been minimized.

Copy link

rajkishor09 commented Feb 1, 2019

this SO answer helped to fix the issue https://stackoverflow.com/a/36211569/173613.

@alexmullans

This comment has been minimized.

Copy link
Contributor

alexmullans commented Apr 1, 2019

Closing this as it's not a bug with the build tasks. Please see the SO answer shared above this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.