The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).
这个问题怎么解决?只有其中一个dll版本不对称。
.net core sdk 版本不匹配
是Sdk版本低么,本地要用的程序集版本高么?
@Impossible: 发布与运行的电脑sdk版本要一致
@dudu: 我是直接在vs中运行出现的这个错误,不是在本地发布到服务器上出现的。同样的代码在新建项目中就没有问题。
@Impossible: 如果有 global.json 文件,删除试试
@dudu: 没有这个文件
@Impossible: 用dontet run
命令运行有这个错误吗?
@dudu: 项目可以正常运行,只是运行这部分代码有错误。
@Impossible: 不好意思,你这个是不是.net framework项目?
@dudu: core
@Impossible: 如果可以的话,提供一下.csproj中PackageReference部分的内容
@dudu:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <OutputPath>bin\</OutputPath> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.1.0-rc1-final" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" Version="2.1.0-rc1-final" /> <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.2" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.2" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.2" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" /> <PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0003" /> <PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta0003" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" /> </ItemGroup> <ItemGroup> <None Include="Views\Home\About.cshtml" /> <None Include="Views\Home\Contact.cshtml" /> <None Include="Views\Home\Index.cshtml" /> <None Include="Views\Shared\_Layout.cshtml" /> <None Include="wwwroot\images\banner1.svg" /> <None Include="wwwroot\images\banner2.svg" /> <None Include="wwwroot\images\banner3.svg" /> <None Include="wwwroot\images\banner4.svg" /> <None Include="wwwroot\js\site.js" /> <None Include="wwwroot\js\site.min.js" /> <None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-theme.css.map" /> <None Include="wwwroot\lib\bootstrap\dist\css\bootstrap-theme.min.css.map" /> <None Include="wwwroot\lib\bootstrap\dist\css\bootstrap.css.map" /> <None Include="wwwroot\lib\bootstrap\dist\css\bootstrap.min.css.map" /> <None Include="wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.svg" /> <None Include="wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff2" /> <None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.js" /> <None Include="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js" /> <None Include="wwwroot\lib\bootstrap\dist\js\npm.js" /> <None Include="wwwroot\lib\bootstrap\LICENSE" /> <None Include="wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js" /> <None Include="wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js" /> <None Include="wwwroot\lib\jquery-validation\dist\additional-methods.js" /> <None Include="wwwroot\lib\jquery-validation\dist\additional-methods.min.js" /> <None Include="wwwroot\lib\jquery-validation\dist\jquery.validate.js" /> <None Include="wwwroot\lib\jquery-validation\dist\jquery.validate.min.js" /> <None Include="wwwroot\lib\jquery-validation\LICENSE.md" /> <None Include="wwwroot\lib\jquery\dist\jquery.js" /> <None Include="wwwroot\lib\jquery\dist\jquery.min.js" /> <None Include="wwwroot\lib\jquery\dist\jquery.min.map" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\WuJie.Core\WuJie.Core.csproj" /> <ProjectReference Include="..\WuJie.Entity\WuJie.Entity.csproj" /> <ProjectReference Include="..\WuJie.Helper\WuJie.Helper.csproj" /> <ProjectReference Include="..\WuJie.IServices\WuJie.IServices.csproj" /> <ProjectReference Include="..\WuJie.UI.Extend\WuJie.UI.Extend.csproj" /> <ProjectReference Include="..\WuJie.ViewModel\WuJie.ViewModel.csproj" /> </ItemGroup> <ItemGroup> <Reference Include="UEditorNetCore"> <HintPath>..\..\UEditorNetCore\src\UEditorNetCore\bin\Debug\netstandard2.0\UEditorNetCore.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Content Update="nlog.config"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> </Project>
@dudu:
这是Microsoft.AspNetCore.All中的版本号。
@Impossible: 用的是 <TargetFramework>netcoreapp2.0</TargetFramework>
,却引用了 .net core 2.1 的 Microsoft.AspNetCore.Authentication 与 Microsoft.AspNetCore.Authentication.Abstractions
@Impossible: 建议将项目升级到 asp.net core 2.1 ,参考 将 ASP.NET Core 2.0 项目升级至 ASP.NET Core 2.1 RC 1