Questions tagged «.net-standard-2.1»

3
'无法从程序集'Microsoft.AspNetCore.Mvc.Formatters.Json,版本= 3.0.0.0加载类型'Microsoft.AspNetCore.Mvc.MvcJsonOptions'
我netstandard2.1在netcoreapp3.0Web应用程序中使用库。在中添加服务时Startup,出现以下错误: '无法从程序集'Microsoft.AspNetCore.Mvc.Formatters.Json,版本= 3.0.0.0加载类型'Microsoft.AspNetCore.Mvc.MvcJsonOptions' 我还在Microsoft.AspNetCore.Mvc类库中使用了2.2.0包中的某些功能。 这是我的图书馆.csproj, <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" /> </ItemGroup> </Project> 这是ServiceExtensions我图书馆的课, public static class ServiceExtensions { public static IMvcBuilder AddMyLibrary(this IMvcBuilder builder) { builder.Services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>(); builder.AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); }); builder.Services.ConfigureOptions<ConfigureLibraryOptions>(); return builder; } } 这是我的ConfigureLibraryOptions课, public class ConfigureLibraryOptions : …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.