dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.7k stars 3.17k forks source link

Could not load file or assembly System.ComponentModel.Annotations, Version=4.2.0.0 #13268

Closed obelixA closed 1 year ago

obelixA commented 6 years ago

Hi

the past few days I tried to get out of "DLL hell 2.0" aka nuget packages :-) I setup my whole solution on VS in a brand new directory, created each project as a new one and only tool the sources over. Doing this I also updated alle the nuget packages to the latest version. Running the app it hits an exception when doing "Database.Migrate()"

I tried every workaround I found in the web. Adding binding redirect in the csproj, manually settings the version numbers in the app.config, downgrading everything to the latest stable (hitting another exception (System.Interactive.Async Version=3.0.3000.0 - also well documented and for me unresolvable)

My current state is nuget packages as described below and hitting the Annotation version conflict.

I hope one of the knowing developers can hint me how to fix that issue. (am I the only one? if not, why do the devs getting the same exception not document hoe to work around while not the nuget "fire and forget" mentality works?)

so any advice is welcome :-)

Exception message:
Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies

Further technical details

EF Core version: 2.2.0-preview1-35029 Database Provider: SQLite provider Operating system: Win10 IDE: VS 15.8.3

ajcvickers commented 6 years ago

@obelixA Can you post the csproj file?

obelixA commented 6 years ago

`
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{7172124B-88FE-4C27-952A-3BDF205E1BCE}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ActiveCashSystem</RootNamespace>
    <AssemblyName>DataReaderWriterSQLITE</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Microsoft.Data.Sqlite, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Data.Sqlite.Core.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.EntityFrameworkCore, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.EntityFrameworkCore.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.EntityFrameworkCore.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.EntityFrameworkCore.Abstractions.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.EntityFrameworkCore.Relational, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.EntityFrameworkCore.Relational.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Relational.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.EntityFrameworkCore.Sqlite, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.EntityFrameworkCore.Sqlite.Core.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Sqlite.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Caching.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Caching.Abstractions.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Caching.Memory, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Caching.Memory.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Configuration.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration.Binder, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Configuration.Binder.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.2.2.0-preview1-35029\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Logging.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Options, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Options.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Extensions.Primitives.2.2.0-preview1-35029\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCL.raw, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\packages\SQLitePCL.raw.0.9.4-pre1\lib\net45\SQLitePCL.raw.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.batteries_e_sqlite3, Version=1.1.11.121, Culture=neutral, PublicKeyToken=17faffbb2a73a73f, processorArchitecture=MSIL">
      <HintPath>..\..\packages\SQLitePCLRaw.bundle_e_sqlite3.1.1.11\lib\net45\SQLitePCLRaw.batteries_e_sqlite3.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.batteries_green, Version=1.1.11.121, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL">
      <HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.batteries_v2, Version=1.1.11.121, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
      <HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.core, Version=1.1.11.121, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
      <HintPath>..\..\packages\SQLitePCLRaw.core.1.1.11\lib\net45\SQLitePCLRaw.core.dll</HintPath>
    </Reference>
    <Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.1.11.121, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL">
      <HintPath>..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.11\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
    </Reference>
    <Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
    </Reference>
    <Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
    </Reference>
    <Reference Include="System.ComponentModel.Composition" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Console, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Console.4.3.1\lib\net46\System.Console.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Core" />
    <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.5.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
    </Reference>
    <Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Interactive.Async, Version=3.2.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Interactive.Async.3.2.0\lib\net46\System.Interactive.Async.dll</HintPath>
    </Reference>
    <Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.IO.Compression.FileSystem" />
    <Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Memory.4.5.1\lib\netstandard2.0\System.Memory.dll</HintPath>
    </Reference>
    <Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Numerics" />
    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
    </Reference>
    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
    </Reference>
    <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
      <Private>True</Private>
      <Private>True</Private>
    </Reference>
    <Reference Include="TracerX-Logger, Version=6.1.1304.13122, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\packages\TracerX-Logger.6.1\lib\TracerX-Logger.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Contexts\acsFacturaContext.cs" />
    <Compile Include="Contexts\acsKasseContext.cs" />
    <Compile Include="Contexts\GutscheinContext.cs" />
    <Compile Include="Contexts\HelpContext.cs" />
    <Compile Include="Contexts\KostenstellenGeneratorContext.cs" />
    <Compile Include="Contexts\LockingContext.cs" />
    <Compile Include="Contexts\LogContext.cs" />
    <Compile Include="Contexts\MappingContext.cs" />
    <Compile Include="DataReaderWriterSQLITE.cs" />
    <Compile Include="Migrations-acsFactura\20170319165849_acsFactura_Initial.cs" />
    <Compile Include="Migrations-acsFactura\20170319165849_acsFactura_Initial.Designer.cs">
      <DependentUpon>20170319165849_acsFactura_Initial.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsFactura\acsFacturaContextModelSnapshot.cs" />
    <Compile Include="Migrations-acsKasse\20170202104951_MyFirstMigration.cs" />
    <Compile Include="Migrations-acsKasse\20170202104951_MyFirstMigration.Designer.cs">
      <DependentUpon>20170202104951_MyFirstMigration.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170202153856_KundenInfo_Notiz.cs" />
    <Compile Include="Migrations-acsKasse\20170202153856_KundenInfo_Notiz.Designer.cs">
      <DependentUpon>20170202153856_KundenInfo_Notiz.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170212084627_Gutscheine.cs" />
    <Compile Include="Migrations-acsKasse\20170212084627_Gutscheine.Designer.cs">
      <DependentUpon>20170212084627_Gutscheine.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170212185540_GS_Rabatte.cs" />
    <Compile Include="Migrations-acsKasse\20170212185540_GS_Rabatte.Designer.cs">
      <DependentUpon>20170212185540_GS_Rabatte.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170310220932_OLVState.cs" />
    <Compile Include="Migrations-acsKasse\20170310220932_OLVState.Designer.cs">
      <DependentUpon>20170310220932_OLVState.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170320160500_Telefonnummernsuche.cs" />
    <Compile Include="Migrations-acsKasse\20170320160500_Telefonnummernsuche.Designer.cs">
      <DependentUpon>20170320160500_Telefonnummernsuche.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170330191444_AZE_first.cs" />
    <Compile Include="Migrations-acsKasse\20170330191444_AZE_first.Designer.cs">
      <DependentUpon>20170330191444_AZE_first.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170416100055_Reservierungen_first.cs" />
    <Compile Include="Migrations-acsKasse\20170416100055_Reservierungen_first.Designer.cs">
      <DependentUpon>20170416100055_Reservierungen_first.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20170818142254_KassenbuchBestand.cs" />
    <Compile Include="Migrations-acsKasse\20170818142254_KassenbuchBestand.Designer.cs">
      <DependentUpon>20170818142254_KassenbuchBestand.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20171013065055_B2O_first.cs" />
    <Compile Include="Migrations-acsKasse\20171013065055_B2O_first.Designer.cs">
      <DependentUpon>20171013065055_B2O_first.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20171125152800_GS_PartnerLokal.cs" />
    <Compile Include="Migrations-acsKasse\20171125152800_GS_PartnerLokal.Designer.cs">
      <DependentUpon>20171125152800_GS_PartnerLokal.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20171126083828_GS_PartnerLokalListe.cs" />
    <Compile Include="Migrations-acsKasse\20171126083828_GS_PartnerLokalListe.Designer.cs">
      <DependentUpon>20171126083828_GS_PartnerLokalListe.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20171219145725_Preisebenen.cs" />
    <Compile Include="Migrations-acsKasse\20171219145725_Preisebenen.Designer.cs">
      <DependentUpon>20171219145725_Preisebenen.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20180523070725_Mappings.cs" />
    <Compile Include="Migrations-acsKasse\20180523070725_Mappings.Designer.cs">
      <DependentUpon>20180523070725_Mappings.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20180524145249_Kostenstellen.cs" />
    <Compile Include="Migrations-acsKasse\20180524145249_Kostenstellen.Designer.cs">
      <DependentUpon>20180524145249_Kostenstellen.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\20180626081145_GemerkteWerte.cs" />
    <Compile Include="Migrations-acsKasse\20180626081145_GemerkteWerte.Designer.cs">
      <DependentUpon>20180626081145_GemerkteWerte.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-acsKasse\acsKasseContextModelSnapshot.cs" />
    <Compile Include="Migrations-Help\20170310080312_Help_Initial.cs" />
    <Compile Include="Migrations-Help\20170310080312_Help_Initial.Designer.cs">
      <DependentUpon>20170310080312_Help_Initial.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-Help\HelpContextModelSnapshot.cs" />
    <Compile Include="Migrations-logging\20170722191556_Logging_initial.cs" />
    <Compile Include="Migrations-logging\20170722191556_Logging_initial.Designer.cs">
      <DependentUpon>20170722191556_Logging_initial.cs</DependentUpon>
    </Compile>
    <Compile Include="Migrations-logging\LogContextModelSnapshot.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\Management\Manager\Manager.csproj">
      <Project>{1c69894c-51fe-4f05-be9d-47db1bfb8341}</Project>
      <Name>Manager</Name>
    </ProjectReference>
    <ProjectReference Include="..\..\Management\Types\Types.csproj">
      <Project>{817c75e9-836f-4c37-bd85-d694a897a7f1}</Project>
      <Name>Types</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <PostBuildEvent>copy *.dll $(SolutionDir)\$(OutDir)
copy *.PDB $(SolutionDir)\$(OutDir)</PostBuildEvent>
  </PropertyGroup>
  <Import Project="..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" />
    <Error Condition="!Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" />
    <Error Condition="!Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
    <Error Condition="!Exists('..\..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
  </Target>
  <Import Project="..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
  <Import Project="..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
  <Import Project="..\..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
</Project>
`
ajcvickers commented 6 years ago

@obelixA The problem may be related to binding re-directs not being added for class library projects. There is apparently an "Add-BindingRedirect" command that might help, but the general consensus on the team is that getting this to work with old-style "packages.config" NuGet will be hard and the best bet for success is to switch over to using "package references". There is a way to migrate or just switch on package references in NuGet config and create the project again.

obelixA commented 6 years ago

@ajcvickers First of all: thanks for your help! My first try was to only convert the trouble making project. NOPE, does not work. Than I converted all 84 projects in the solution. Clean, rebuild and... NOPE, doesn't work either. So by now I have a top modern solution with some 100k lines of code that can compile perfectly (ok nearly perfectly, some warnings left) but cannot be executed.., Do you have an idea what I could do else? thanks in advance!

ajcvickers commented 6 years ago

@obelixA When you say, "doesn't work" do you mean it still gives the same error?

obelixA commented 6 years ago

yes. same error...

DBReaderWriter : Die Datei oder Assembly "System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)

ajcvickers commented 6 years ago

@obelixA Unfortunately we're out of ideas to try. Would it be possible to post a project/solution that reproduces what you are seeing so that we can investigate?

obelixA commented 6 years ago

Would a remote session be ok? There are so many libraries involved that I'm not sure I can create a test project that reflects the circumstances... If so, drop me a message at a dot bohmann at acs-it-systems dot de

ajcvickers commented 6 years ago

@obelixA Unfortunately this isn't something we will be able to do. If you have a support contract with Microsoft, then you might want to follow up through that channel.

obelixA commented 6 years ago

ok, so i'll do my very best to create a project reflecting the issue...

ajcvickers commented 6 years ago

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

obelixA commented 6 years ago

I'll do my very best to provide the project, but I am ill and bound to bed since several days and will have to stay afk for some more days :-( sorry for that delay, but I will come around with a project for sure when again fit for work...

gojanpaolo commented 6 years ago

I get the same exception on a .NET Framework 4.7.2 project with xunit, and setting xunit.runner.json appDomain to denied

sample project: https://github.com/gojanpaolo/ef-13268

ajcvickers commented 6 years ago

@gojanpaolo Thanks!

ajcvickers commented 6 years ago

@karelz @danmosemsft @natemcmaster The sample project in the comment is very minimal and reproduces the issue. I have spent a couple of hours investigating without luck and there is nothing specific to EF in this other than the combination of packages. So my guess is that this is an issue with:

Ideas on who/where to continue the investigation?

natemcmaster commented 6 years ago

@gojanpaolo which xunit runner are you using? I tried your repro in VS and didn't get an error.

image

gojanpaolo commented 6 years ago

@natemcmaster I am using the VS runner. Let me try again and let you know the results.

gojanpaolo commented 6 years ago

@natemcmaster I just tried the sample project as it is and I get the exception. I use VS 15.7.2 and Win7. image

natemcmaster commented 6 years ago

I used VS 15.9 Preview on Windows 10. I wonder if this could have anything to do with the version of .NET Framework or Visual Studio. I’m not the right person to investigate this further unfortunately. @ajcvickers you might try forwarding this to the VS Test or .NET Framework teams internally.

ajcvickers commented 6 years ago

@natemcmaster It repros for me 100% in the VS test runner with the latest 15.8 on Win10. I'll try 15.9 tomorrow.

ErikEJ commented 6 years ago

@gojanpaolo Please try to update your .NET Framework version to 4.7.1 or later

gojanpaolo commented 6 years ago

@ErikEJ I checked the .NET framework version on my machine and it seems to be 4.7.2 (Release is 461814).

image

ajcvickers commented 6 years ago

@ErikEJ I also have 4.7.2 on the machine where this fails.

ajcvickers commented 6 years ago

So it turns out I was actually using the R# test runner out of habit, rather than the VS runner. With the VS runner the test passes for me on two different machines, both of which don't work with the R# test runner. So this means I'm now back to not being able to reproduce what @gojanpaolo is seeing.

@gojanpaolo Can you post the text from the Output window. On my machine where it works I see:

[9/26/2018 9:22:51 AM Informational] ------ Run test started ------
[9/26/2018 9:22:53 AM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.0 (32-bit Desktop .NET 4.0.30319.42000)
[9/26/2018 9:22:54 AM Informational] [xUnit.net 00:00:00.69]   Discovering: net_472
[9/26/2018 9:22:54 AM Informational] [xUnit.net 00:00:00.75]   Discovered:  net_472
[9/26/2018 9:22:54 AM Informational] [xUnit.net 00:00:00.75]   Starting:    net_472
[9/26/2018 9:22:54 AM Informational] [xUnit.net 00:00:01.20]   Finished:    net_472
[9/26/2018 9:22:55 AM Informational] ========== Run test finished: 1 run (0:00:03.2705114) ==========
gojanpaolo commented 6 years ago

@ajcvickers Please see output text. Should I try updating VS to 15.8 (currently using 15.7.4)?

[9/26/2018 11:34:56 AM Informational] ------ Run test started ------
[9/26/2018 11:34:57 AM Error] An exception occurred while invoking executor 'executor://xunit/VsTestRunner2/uap': Could not find Windows Runtime type 'Windows.ApplicationModel.Package'.
Operation is not supported on this platform.
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.0 (32-bit Desktop .NET 4.0.30319.42000)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.14]   Discovering: net_472
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.18]   Discovered:  net_472
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.19]   Starting:    net_472
[9/26/2018 11:34:57 AM Error] [xUnit.net 00:00:00.44]     net_472.Tests.Test [FAIL]
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]       System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]       Stack Trace:
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.CoreConventionSetBuilder.CreateConventionSet()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateConventionSet(IConventionSetBuilder conventionSetBuilder)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.<GetModel>b__1()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at System.Lazy`1.CreateValue()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at System.Lazy`1.LazyInitValue()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at System.Lazy`1.get_Value()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_1(IServiceProvider p)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Internal.InternalAccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_DatabaseCreator()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]            at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.44]         net_472\Tests.cs(17,0): at net_472.Tests.Test()
[9/26/2018 11:34:57 AM Informational] [xUnit.net 00:00:00.45]   Finished:    net_472
[9/26/2018 11:34:58 AM Informational] ========== Run test finished: 1 run (0:00:01.254) ==========
ajcvickers commented 6 years ago

@gojanpaolo Worth trying.

ajcvickers commented 6 years ago

@natemcmaster @danmosemsft The version of the "System.ComponentModel.Annotations" package we are building against is 4.5.0: https://github.com/aspnet/EntityFrameworkCore/blob/release/2.1/build/dependencies.props#L27

But the version of the assembly in the 4.5.0 NuGet package for net461 is 4.2.1:

image

However, the referenced assembly version in the EF assembly from the released 2.1.3 package is 4.2.0:

image

None of this makes sense to me...but that doesn't mean it's wrong. Is it wrong?

natemcmaster commented 6 years ago

It’s not necessarily wrong because package version and assembly version don’t align. Corefx packages and assemblies version differently from aspnet. /cc @weshaggard

ajcvickers commented 6 years ago

@natemcmaster But why would EF reference assembly version 4.2.0 when the package contains 4.2.1?

gojanpaolo commented 6 years ago

@ajcvickers Updating to VS 15.8.5 fixed the issue.

weshaggard commented 6 years ago

@ajcvickers as @natemcmaster states the package version and assembly version are intentionally not supposed to match because we have multiple versions of binaries in the packages so the package version matches all other packages released at the same time.

As for the ref and lib having different versions that is also intentional to handle issues where folks can reference this library and try to run on an older framework that has the library inbox, to prevent that from breaking we pin the version of the reference assembly for places where it might run on an inbox framework that has this older version (see https://github.com/dotnet/corefx/blob/master/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj#L6).

All that seems expected.

I couldn't figure out the minimal repo to try this out but from the discussion it definitely seems like an issue with binding redirects.

ajcvickers commented 6 years ago

@weshaggard The following binding redirect was added automatically:

<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />

This looks right to me, but isn't working. Here's the fusion failure from my machine:

=== Pre-bind state information ===
LOG: DisplayName = System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Users/avickers/AppData/Local/JetBrains/Installations/ReSharperPlatformVs15_e3d70382/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = JetBrains.ReSharper.TaskRunner.CLR45.x64.exe
Calling assembly : Microsoft.EntityFrameworkCore, Version=2.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Users\avickers\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_e3d70382\JetBrains.ReSharper.TaskRunner.CLR45.x64.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/avickers/AppData/Local/JetBrains/Installations/ReSharperPlatformVs15_e3d70382/System.ComponentModel.Annotations.DLL.
LOG: Attempting download of new URL file:///C:/Users/avickers/AppData/Local/JetBrains/Installations/ReSharperPlatformVs15_e3d70382/System.ComponentModel.Annotations/System.ComponentModel.Annotations.DLL.
LOG: Attempting download of new URL file:///C:/Users/avickers/AppData/Local/JetBrains/Installations/ReSharperPlatformVs15_e3d70382/System.ComponentModel.Annotations.EXE.
LOG: Attempting download of new URL file:///C:/Users/avickers/AppData/Local/JetBrains/Installations/ReSharperPlatformVs15_e3d70382/System.ComponentModel.Annotations/System.ComponentModel.Annotations.EXE.
LOG: Attempting download of new URL file:///C:/Stuff/ef-13268-master/ef-13268-master/ef-13268/net_472/bin/Debug/System.ComponentModel.Annotations.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Stuff\ef-13268-master\ef-13268-master\ef-13268\net_472\bin\Debug\System.ComponentModel.Annotations.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
LOG: Attempting download of new URL file:///C:/Stuff/ef-13268-master/ef-13268-master/ef-13268/net_472/bin/Debug/System.ComponentModel.Annotations/System.ComponentModel.Annotations.DLL.
LOG: Attempting download of new URL file:///C:/Stuff/ef-13268-master/ef-13268-master/ef-13268/net_472/bin/Debug/System.ComponentModel.Annotations.EXE.
LOG: Attempting download of new URL file:///C:/Stuff/ef-13268-master/ef-13268-master/ef-13268/net_472/bin/Debug/System.ComponentModel.Annotations/System.ComponentModel.Annotations.EXE.
LOG: All probing URLs attempted and failed.
weshaggard commented 6 years ago

Yes that binding redirect looks correct however are you sure that one is being used?

LOG: Post-policy reference: System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

From the log it looks like it is using the 4.2.0.0 policy but not sure where that is coming from.

weshaggard commented 6 years ago

@AlexGhiondea @joperezr does this issue look familiar? I think System.ComponentModelAnnotations is inbox on .NET 4.7.2 and if that is the case it might be unifying down to 4.2.0.0 but even in that case I'd expect it to use find the one in the GAC if that were true.

AlexGhiondea commented 6 years ago

If you have binding redirects in your application then we won't unify the reference -- we will use whatever version you have redirected to.

ajcvickers commented 6 years ago

@AlexGhiondea Removing the binding redirect doesn't change the behavior.

ajcvickers commented 6 years ago

@weshaggard @AlexGhiondea @joperezr Any further thoughts on this? Does it look like a bug--if so, where would the appropriate place be to file it?

AlexGhiondea commented 6 years ago

@ajcvickers a couple comments above someone mentioned that upgrading to the latest VS solved the issue for them -- does that solve it for you?

ajcvickers commented 6 years ago

@AlexGhiondea It solves it with the VS test runner, but not the R# test runner. If we're confident that this is a test runner issue then I will close, however the original report doesn't say anything about the test runner. More fundamentally, it doesn't seem like there is an understanding from anyone one on why it is failing.

AlexGhiondea commented 6 years ago

@ajcvickers I am glad to hear that this is partially addressed by an updated VS. Is there a way to get a minimal repro so that we can debug the loader and try to understand what is happening?

ajcvickers commented 6 years ago

@AlexGhiondea Yes--it is referenced in this comment: https://github.com/aspnet/EntityFrameworkCore/issues/13268#issuecomment-424108108

joperezr commented 6 years ago

One thing to note, is that there are some test runners that won't honor the App.config file so binding redirects are not used. That might explain why you have the redirect but it the loader is still trying to use a higher version. I'm not sure if the R# test runner is one of those who don't honor the config file though.

alexvkru commented 6 years ago

@ajcvickers Updating to VS 15.8.5 fixed the issue.

No, i'm updated VS to 15.8.5, but problem still exists.

alexvkru commented 6 years ago

I have similary problem, but haven't solution for it. If i use single project (EF Core SQlite WPF) - all just work. If I try to use separate project for UI (WPF) and data (EF Core + SQlite) - i have error: "Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies". I tried all of possible solutions from this issue and from other places, but still have this error again.

daghb commented 6 years ago

[rant]

For every new VS/MSBuild version, the dll hell is more and more evident. What I am unable to fathom, is why the endless problems with these assemblyredirects is not taken care of at all. After almost 30 years with build problems due to DLLs I do not see the end at all - it has actually never been as crazy as it is now. Could you please fix this, once and for all - and give us ways to upgrade from old .NET Frameworks, old csproj file structures, NuGet package upgrades etc etc. instead of giving the developers all the pain. Please.

[/rant]

obelixA commented 6 years ago

Back from my illness I have a minimal demo project to reflect the issue

hope this helps. My suspicion, as already mentioned in a post above, that it has to do with separated projects...

Test.zip

AlexGhiondea commented 6 years ago

@obelixA thanks for the repro project. I have tried that on my machine but I am unable to repro it. Do I ned to do any set up on the machine for the issue to repro or just opening the project and running should be enough?

obelixA commented 6 years ago

@AlexGhiondea just open it and run (debug). That's enough on my machine. When I am back on the machine I will provide details about VS...

obelixA commented 6 years ago

I hope to get this solved soon, because no new releases are possible right now :-(

Here are the infos about VS

Microsoft Visual Studio Community 2017 Version 15.8.6 VisualStudio.15.Release/15.8.6+28010.2041 Microsoft .NET Framework Version 4.7.03056

Installed Version: Community

AnkhSVN - Subversion Support for Visual Studio 2.7.12815.35086 AnkhSVN - Subversion Support for Visual Studio 2.7.12815.35086

SharpSvn is linked to: Apr 1.5.2, Apr-util 1.5.4, Cyrus Sasl 2.1.26, eXpat 2.2.0, LibSSH2 1.8.0, OpenSSL 1.0.2k 26 Jan 2017, Serf 1.3.9, SQLite 3.17.0, Subversion 1.9.5-SharpSvn, Utf8proc 1.1.5, ZLib 1.2.8 SharpSvn is optionally linked to: Berkeley DB 4.4.20, SharpPlink 0.67.0(SharpSvn)

SharpGit is linked to: Apr 1.5.1, Apr-Util 1.5.4, eXpat 2.1.0, Libgit2 0.24.0, LibSSH2 1.7.0, OpenSSL 1.0.2h 3 May 2016, Subversion 1.9.3, Utf8proc 1.1.5, ZLib 1.2.8

Application Insights Tools for Visual Studio Package 8.13.10627.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.8.05085.0 ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 15.8.31590 Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.60618.0 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 15.8.05023.0 Azure App Service Tools v3.0.0

C# Tools 2.9.0-beta8-63208-01 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service 2.0 JavaScript Language Service

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 1.0 Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

NuGet Package Manager 4.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools 15.1.61808.07020 Microsoft SQL Server Data Tools

TargetFrameworkMigrator 1.0 Bulk Change .Net Projects Target Frameworks

TypeScript Tools 15.8.20822.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.9.0-beta8-63208-01 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

ErikEJ commented 6 years ago

Your zip file solution is not runnable on other machines, projects are missing