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.
<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>
Builds successfully
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"
but I think I can do that in SDK with a BeforeTargets="Restore"
Looks like BeforeTargets="Restore" doesn't run for solution restores. https://github.com/dotnet/cli/issues/5683
@dasMulli Yes. Just hit this and it was also running too late. Using BeforeTargets="_GenerateRestoreProjectSpec" fixes both issues.
btw, I think this would help a lot when using native dependencies for library projects that target full fx + specific RID and netstandard. (https://github.com/dotnet/cli/issues/5241, https://github.com/dotnet/cli/issues/5241#issuecomment-271392503)
@emgarten Can you review efbcaca, which is incorporated in to the larger #847
@emgarten Can you review efbcaca, which is incorporated in to the larger #847
This change looks good to me. Restore will read this union and apply it for all TFMs.