Reputation: 79
when I am running my application then it's showing me error like Could not load type 'Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
.
My csproj file contains code like below :
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Insurance_Customer_Portal_API</RootNamespace>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="4.1.1" />
<PackageReference Include="SwashBuckle.AspNetCore.MicrosoftExtensions" Version="0.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0" />
</ItemGroup>
</Project>
Is there any things which I need to change in code ?
Upvotes: 0
Views: 7347
Reputation: 9845
You have some dependencies in your project that are not required anymore, which are causing a mismatch of actually used DLLs that end up in the build-output.
Microsoft.NET.Sdk.Web
and >=
netcoreapp3.0
, a reference to Microsoft.AspNetCore.App
is not
required so that line can be safely removed.Microsoft.AspNetCore.Cors
is also part of the framework now so you
don't need an explicit reference.Microsoft.AspNetCore.Mvc.NewtonsoftJson
which can be found
here.Upvotes: 2