question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build doesn't honour conditional RID when creating project.assets.json

See original GitHub issue

Building won’t honour conditional RIDs inside the csproj file, project.assets.json will always have the first one declared, thus failing build with several bad references if the second one is targeted.

Steps to reproduce

Add a conditional RID to the csproj:

  <PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)'=='Release' ">
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
  </PropertyGroup>

Expected behavior

In Debug project.assets.json has

    "runtimes": {
      "win7-x86": {
        "#import": []
      }
    }

And in Release

    "runtimes": {
      "win7-x64": {
        "#import": []
      }
    }

Actual behavior

In Release project.assets.json has

    "runtimes": {
      "win7-x86": {
        "#import": []
      }
    }

While build is targeting the RID win7-x64, so build fails with several bad references.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc4-004578)

Product Information: Version: 1.0.0-rc4-004578 Commit SHA-1 hash: 93a94e652b

Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.0-rc4-004578

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dasMullicommented, Jan 27, 2017

I’d suggest just adding the following:

<RuntimeIdentifiers>win7-x86;win7-x46</RuntimeIdentifiers>

That way, nuget should restore both runtimes and build/publish will select one of them based on the configuration.

0reactions
djfrcommented, Jan 28, 2017

Thanks @dasMulli !

This worked perfectly, what I was missing since the start was: <RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>

I also tested a deployment to the Azure ASE and it runs perfectly.

Oddly enough, at home on my laptop I can’t debug in x86, which led me to poke around and I have VS options set to use IISExpress 64bit mode and on the IISExpress config I have all app pools running in 64bit, so here I can only debug against win7-x64.

I’ll check our dev box configuration on Monday to see what it looks like, it might be that, for now, we just run IISExpress in 64bit with 64bit app pools and just keep everything using the win7-x64 RID.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Assets file project.assets.json not found. Run a NuGet ...
To fix this error from Tools > NuGet Package Manager > Package Manager Console simply run: dotnet restore. The error occurs because the ......
Read more >
NuGet Restore build issues - project.assets.json doesn't ...
If you run restore using dontet or msbuild, and then check if the project. asset. json is regenerated. It should be different from...
Read more >
NETSDK1004: Assets file not found - .NET CLI
This error occurs when the assets file project. assets. json is not found during build. The full error message is similar to the...
Read more >
Testing Guide
The project to build this guide keeps this expertise in the hands of the people who need it - you, me and anyone...
Read more >
Untitled
Goldair sandwich press, Church village background, Dog does not want to eat ... 2019 mazda cx 5 price paid, Brand building strategies in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found