build doesn't honour conditional RID when creating project.assets.json
See original GitHub issueBuilding 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:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d suggest just adding the following:
That way, nuget should restore both runtimes and build/publish will select one of them based on the configuration.
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.