Skip to content

Different RID behavior for multitargeted restore in VS and command line #871

@nguerrera

Description

@nguerrera

If RuntimeIdentifer(s) differ between inner builds, then VS will gather the properties from each inner build and send them on to restore whereas the command line restore target only reads them from the outer evaluation context.

Repro project

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netcoreapp1.0;netcoreapp1.1</TargetFrameworks>
    <RuntimeIdentifier Condition="'$(TargetFramework)' == 'netcoreapp1.0'">win7-x86</RuntimeIdentifier>
    <RuntimeIdentifier Condition="'$(TargetFramework)' == 'netcoreapp1.1'">win7-x64</RuntimeIdentifier>
  </PropertyGroup>
</Project>

Behavior in VS (and expected behavior)

Builds successfully

Behavior on command line (dotnet restore; dotnet build)

C:\...\Microsoft.NET.Sdk.targets(92,5): error : Assets file 'C:\...\ConsoleApp144\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v1.0/win7-x86'. Ensure you have restored this project for TargetFramework='netcoreapp1.0' and RuntimeIdentifier='win7-x86'. [C:\...\ConsoleApp144.csproj]

(and other related errors)

@emgarten @srivatsn @natidea This is causing issues for #847 in multi-targeted app case. I think the right fix would be in nuget restore targets to gather all RIDs from inner builds, but I think I can do that in SDK with a BeforeTargets="Restore"

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions