I am working on an ASP.NET Core v2.1 Razor Pages project in which I am working on implementing Auth0 for user authentication. After setting everything up, I attempted to build my project and am getting the following exception:
System.TypeLoadException: 'Could not load type 'Microsoft.Extensions.Primitives.InplaceStringBuilder'
from assembly 'Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60'.'
In order to set up Auth0, I had to install the Microsoft.Extensions.Primitives nuget package. However, when trying to build my project, this is the error I get. If I remove the package, when I try and build the project, I get the following error:
Version conflict detected for Microsoft.Extensions.Primitives. Install/reference
Microsoft.Extensions.Primitives 5.0.0 directly to your project to resolve this issue.
The following code is where the exception is being thrown:
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
I have read that InplaceStringBuilder does not exist in Microsoft.Extensions.Primitives anymore so I am assuming this is causing the problem. However, I don't see InplaceStringBuilder being used anywhere so I can't seem to figure out what it is even needed for.
Does anyone know a way to resolve this issue?
Probably you have some package that uses Microsoft.Extensions.Primitives
on Version >= 5.0.0
I had a similar problem a few days ago. In my scenario, I was working on an ASP.NET Core v2.1 WEB API
and a dependency with a project that was using the package Microsoft.Extensions.Configuration.Abstractions
on Version="5.0.0"
caused the problem. I was able to solve the problem by downgrading that package from Version 5.0.0
to Version 2.1.0
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With