2017-04-12 21 views
0

私のdebian 8サーバーでdotnetコアアプリケーションを実行しようとしています。私のアプリは2つに分かれています。Entity Frameworkのコア例外 "System.Runtime.Versioning.BinaryCompatibility"

  • コンソールアプリケーション
  • データベースアクセスDLL

私はマイクロソフトDOTNETのウェブサイト上でランタイムをインストールするための指示に従いました。

私のコンソールアプリケーションを起動すると、Entity Framework Coreが例外をスローします。

例外メッセージ:

は 'System.Runtime.Versioning.BinaryCompatibility' のタイプ初期化子が例外をスローしました。

内部例外メッセージ:

は、 'カルチャニュートラル、PublicKeyToken = = b03f5f7f11d50a3a、バージョン= 4.1.1.0をSystem.Runtime.InteropServices' ファイルまたはアセンブリをロードできませんでした。配置されたアセンブリの最も新しい定義がアセンブリ参照と一致しません。 (HRESULTからの例外:0x80131040)

これは私のアプリが設定されている方法です。

<Project Sdk="Microsoft.NET.Sdk"> 

    <PropertyGroup> 
    <AssemblyTitle>Project.Login</AssemblyTitle> 
    <TargetFramework>netcoreapp1.1</TargetFramework> 
    <AssemblyName>Project.Login</AssemblyName> 
    <OutputType>Exe</OutputType> 
    <PackageId>Project.Login</PackageId> 
    <RuntimeIdentifiers>win10-x64;win7-x64;osx.10.10-x64;ubuntu.14.04-x64;ubuntu.14.10-x64;ubuntu.15.04-x64;ubuntu.15.10-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;debian.8-x64;fedora.23-x64;fedora.24-x64</RuntimeIdentifiers> 
    <PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback> 
    <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion> 
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> 
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> 
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> 
    </PropertyGroup> 

    <ItemGroup> 
    <ProjectReference Include="..\Project.Core\Project.Core.csproj" /> 
    <ProjectReference Include="..\Project.Database\Project.Database.csproj" /> 
    </ItemGroup> 

    <ItemGroup> 
    <PackageReference Include="Ether.Network" Version="1.1.7" /> 
    </ItemGroup> 

</Project> 

そして、私のProject.Database構成:

<Project Sdk="Microsoft.NET.Sdk"> 

    <PropertyGroup> 
    <TargetFramework>netstandard1.6</TargetFramework> 
    <AssemblyName>Project.Database</AssemblyName> 
    <PackageId>Project.Database</PackageId> 
    <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion> 
    <PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback> 
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> 
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> 
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> 
    </PropertyGroup> 

    <ItemGroup> 
    <PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" /> 
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="1.1.0" /> 
    <PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" /> 
    <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="7.0.6-IR31" /> 
    </ItemGroup> 

</Project> 

私は貴様のランタイムとSDKを試してみましたまだ同じ問題です。

あなたは問題が何であるか知っていますか?

答えて

0

解決策が見つかりました。

私は自分のProject.DatabaseプロジェクトにMicrosoft.EntityFrameworkCore 1.1パッケージを追加し、Pomelo.EntityFrameworkCore.MySqlを削除し、2つの行を削除しました:

<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback> 
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion> 

を自分のアプリのプロジェクトの設定から。

これで機能します。

関連する問題