Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Runtime conflict resolution doesn't exclude System.Linq when RuntimeIdentifiers is set #184

Closed
eerhardt opened this issue Jan 27, 2017 · 5 comments

Comments

@eerhardt
Copy link
Member

Extract the following
ConflictBug.zip

dotnet restore App
dotnet run -p App\ConflictBug.csproj

Expected result:
The app should run fine.

Actual result:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Linq, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at ConsoleApp.Program.Main(String[] args)

Looking at the .deps.json file, the "runtime" sections aren't getting removed for System.Linq, System.Linq.Parallel, etc even though these files are in the shared framework.

If I remove the line <RuntimeIdentifiers>win7-x64;win7-x86;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64;osx.10.10-x64;rhel.7-x64</RuntimeIdentifiers> from the .csproj, the app executes fine.

/cc @ericstj

@ericstj
Copy link
Member

ericstj commented Jan 27, 2017

Which CLI should I be using?

@eerhardt
Copy link
Member Author

I used a locally built one from dotnet/cli/master. But the latest from https://github.com/dotnet/cli/tree/master#installers-and-binaries should work.

@ericstj
Copy link
Member

ericstj commented Jan 27, 2017

Bug is here: https://github.com/dotnet/core-setup/blob/master/pkg/tasks/GenerateFileVersionProps.cs#L87

The reason I did this was to address the case where we're building a shared framework app and don't have the runtime-specific packages in the view. I thought the only case that'd happen was when RIDs aren't set since that's how nuget3 targets worked, but it looks like the CLI is using the RID-less target for execution even for a standalone app.

@ericstj
Copy link
Member

ericstj commented Jan 27, 2017

To workaround this you can edit .nuget\packages\microsoft.netcore.app\2.0.0-dev-eng-001308-00\build\netcoreapp2.0\Microsoft.NETCore.App.props
from

  <ItemGroup Condition="'$(RuntimeIdentifer)' == '' AND '$(RuntimeIdentifiers)' == ''">
    <PackageConflictPlatformManifests Include="$(MSBuildThisFileDirectory)Microsoft.NETCore.App.PlatformManifest.txt" />
  </ItemGroup>

to

  <ItemGroup Condition="'$(RuntimeIdentifer)' == ''">
    <PackageConflictPlatformManifests Include="$(MSBuildThisFileDirectory)Microsoft.NETCore.App.PlatformManifest.txt" />
  </ItemGroup>

@GSPP
Copy link

GSPP commented Oct 15, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants