Install Microsoft.SqlServer.Types in GAC - c#

How do I install Microsoft.SqlServer.Types assembly in GAC (C:\Windows\assembly\GAC_MSIL). It is missing.
I am getting error after running rdlc report. it is MVC based application-
Could not load file or assembly 'Microsoft.SqlServer.Types,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=token' or one of its
dependencies.
It seems application is looking Microsoft.SqlServer.Types assembly in GAC. I know how to install using nuget in project folder but I want it in GAC.

Don’t try to GAC it. Add the NuGet package to your project instead.
https://www.nuget.org/packages/Microsoft.SqlServer.Types

Related

Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference. Version conflict

I am having an error when I want to run my program. The error states that it could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference.
I have checked on my target framework and package reference which I am now using net5.0 framework for my project. But the version of System.Runtime seems to be net6.0 framework. I have checked on my System.Runtime that the version is 5.0.0.0. So obviously the version 6.0.0.0 is missing. Does anyone know how to change the version of System.Runtime to be 5.0.0.0?
Error Message
System Runtime Details
.csproj file
Okay, so i just delete my bin and obj folder and proceed to clean and rebuild my project and it works perfectly. Wasted two days for this.
Got the inspiration from this link.
Credit to Levi Fuller's comment

System.Text.Json 6.0.2 Serialize error - trying to load System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1

We are using C# .Net Framework 4.7.2, JsonSerializer in System.Text.Json Version 6.0.2. Solution builds fine. We get a runtime error when Serializing:
Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
I confirmed that System.Runtime.CompilerServices.Unsafe Assembly Version 6.0.0 isinstalled as part of the NuGet package.
And that App.config contains assembly redirect lines pointing to installed Version:
name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"
bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"
Appreciate any help on how to resolve this - why is System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 needed at Runtime. Thanks!
I had a similar error with Visual Studio 2022 Version 17.1.1 with a new .Net 4.8 WinForms application.
After some hints elsewhere, I opened the NuGet package manger for the solution.
Tools/NuGet Package Manager/Manage NuGet Packages for the Solution...
From there I searched for and added this package to the project that used JsonSerializer.Serialize().
System.Runtime.CompilerServices.Unsafe (V6.0.0)
To be clear this was not a listed installed packaged in the NuGet manager previously.
The runtime exception error changed to:
System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Source=System.Text.Json
So I then searched for and added to the same project:
System.Threading.Tasks.Extensions (V4.5.4)
Again this was not a listed installed package in the NuGet manager before this install.
So far everything continues to work. I did not have to add these packages to the project that defined the class being serialized. Just the one that did the serialization.

Dll issue in Aspnet Core

I am getting System.Web.Http error while I am converting mvc5 application to aspnet core.
I am using class library in an existing project and also not using directly this .dll in class library.
error- Could not load file or assembly 'System.Web.Http,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
Try reinstalling the NuGet package
From the package manager console, type:
Update-Package Microsoft.AspNet.WebApi.Core -reinstall

"The located assemblys manifest definition does not match the assembly reference" with nuget packages. Silverlight project

So I created a local nuget server to serve our Telerik dlls.
Whenever I use the local dlls on my machine (Without nuget), everything works fine. But when I delete the two references and install them through nuget the build fails with the error:
Cannot resolve reference assemblies. please check the reference
assemblies. Could not load file or assembly 'System.Core,
Version=5.0.5.0, Culture=neutral' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT:0x80131040)
I have checked that the local telerik DLL is the same version as the one found in the nuget package.
Anyone have a clue?
PS: Silverlight project

Missing Dependency: Castle.DynamicProxy2 after install LINQtoExecl from NuGet

I recently added the package LinqToExcel to my .net 4 WPF project and now when entering the designer I am presented with the following error:
System.IO.FileNotFoundException
Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.
LinqToExcel only has one dependency - log4net, which it installed as part of the NuGet process. Both are referenced and set to Copy Local. I'm not sure where the reference to Castle is coming from or how to go about fixing it.
Does anyone have any suggestions?

Categories

Resources