CLR / System.IO.FileLoadException:“无法加载文件或程序集' System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089”

时间:2017-12-19 18:10:07

标签: c# google-maps visual-studio-code coreclr

我在Visual Studio Code中的项目中生成了这个异常:

  

发生异常:CLR / System.IO.FileLoadException类型' System.IO.FileLoadException'发生在Infrastructure.dll中但未在用户代码中处理:'无法加载文件或程序集' System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'。定位的程序集的清单定义与程序集引用不匹配。 (HRESULT异常:0x80131040)'位于FrequentFlyer.Infrastructure的d:\ C#\ FrequentFlyer \ FrequentFlyer.Infrastructure \ Services \ GoogleMapsService.cs中的FrequentFlyer.Infrastructure.Services.GoogleMapsService.GetLatLongAsync(AddressData city)的GoogleMaps.LocationServices.GoogleLocationService.GetLatLongFromAddress(字符串地址):第20行。服务.NodeProvider..ctor(IMemoryCache缓存,IGoogleMapsService googleMapsService)位于d:\ C#\ FrequentFlyer \ FrequentFlyer.Infrastructure \ Services \ NodeProvider.cs:第83行,位于Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()

此异常显示在第三行:

public double[] GetLatLongAsync(AddressData city)
{
    var latlong = _googleLocationService.GetLatLongFromAddress(city);
    var latitude = latlong.Latitude;
    var longitide = latlong.Longitude;
    double[] coordinates = {latitude, longitide};

    return coordinates;
}

我认为问题出在我的.csproj文件中。我之前遇到了几乎相同的问题(System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'),但是当我安装了package:" Microsoft.NETCore.Portable.Compatibility&# 34;版本=" 1.0.1",问题消失了。现在再次显示,我无法处理它。

我使用.NET Standard1.6,但是包:GoogleMaps.LocationServices只与.NET Framework 4.0兼容,所以我的.csproj很丑陋(在我看来)。

这是我的.csproj文件:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard1.6</TargetFrameworks>
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);net40</PackageTargetFallback>
    <AssemblyName>Infrastructure</AssemblyName>
    <PackageId>Infrastructure</PackageId>
    <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="../FrequentFlyer.Core/FrequentFlyer.Core.csproj" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Autofac" Version="4.5.0" />
    <PackageReference Include="AutoMapper" Version="6.0.2" />
    <PackageReference Include="GoogleMaps.LocationServices" Version="1.2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.2" />
    <PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
    <PackageReference Include="MongoDb.Driver" Version="2.4.4" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.01" />
    <PackageReference Include="NLog.Extensions.Logging " Version="1.0.0-rtm-beta5 " />
    <PackageReference Include="NLog.Web.AspNetCore" Version="4.4.0" />
    <PackageReference Include="System.Device.Location.Portable" Version="1.0.0" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Mongo\" />
  </ItemGroup>
</Project>

有什么问题,如何解决此问题?

0 个答案:

没有答案