Skip to content

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

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

Closed
nguerrera opened this issue Feb 15, 2017 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@nguerrera
Copy link
Contributor

nguerrera commented Feb 15, 2017

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"

@dasMulli
Copy link
Contributor

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

@nguerrera
Copy link
Contributor Author

@dasMulli Yes. Just hit this and it was also running too late. Using BeforeTargets="_GenerateRestoreProjectSpec" fixes both issues.

@dasMulli
Copy link
Contributor

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)

nguerrera added a commit to nguerrera/sdk that referenced this issue Feb 15, 2017
@nguerrera
Copy link
Contributor Author

@emgarten Can you review efbcaca, which is incorporated in to the larger #847

@emgarten
Copy link
Member

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

mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants