1

I am getting the following error after installing a third-party NuGet package and trying to run.

FileLoadException: Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.4, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Version 4.5.0.4 is not available in the NuGet list. I installed the 4.5.0 version, but it wasn't of any use. How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • What thidpart nuget you used cause this problem? – Nico Zhu Nov 12 '21 at 07:29
  • Have you tried use this line `Install-Package System.ServiceModel.Primitives` to install the package manually in the package manager console? – Nico Zhu Nov 12 '21 at 07:43
  • that is from internal team – TechnologyEnthusiast Nov 12 '21 at 08:29
  • if we didnt mention the version it will install the stable version that might not be the above mentioned version – TechnologyEnthusiast Nov 12 '21 at 08:30
  • Install-Package System.ServiceModel.Primitives 4.5.0.4 Install-Package : Project '4.5.0.4' is not found. At line:1 char:1 + Install-Package System.ServiceModel.Primitives 4.5.0.4 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (4.5.0.4:String) [Install-Package], ItemNotFoundException + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand – TechnologyEnthusiast Nov 12 '21 at 08:33
  • for specific you need use this line `Install-Package System.ServiceModel.Primitives -v 4.5.0.4` – Nico Zhu Nov 12 '21 at 08:54
  • No it has given 4.5.04 not found and installed 4.5.1. When run it gave the same excpetion – TechnologyEnthusiast Nov 12 '21 at 10:10
  • So, the problem may come from your third-part library dependency library. – Nico Zhu Nov 15 '21 at 01:28
  • I created a pure sample uwp project and installe dthe third party library. No issues found there during runtime. – TechnologyEnthusiast Nov 16 '21 at 06:50
  • Does the project build successfully before? – Nico Zhu Nov 16 '21 at 06:52
  • build is succes in both cases. runtime exception happens – TechnologyEnthusiast Nov 16 '21 at 06:58
  • It's hard to reproduce your problem without [mcve], we can only tell same basic troubleshooting. if you can determine this problem related with third-part lib, please go ahead post issue report in github issue box. if not, please post your problem [here](https://github.com/dotnet/wcf/blob/main/release-notes/System.ServiceModel.Primitives.md) – Nico Zhu Nov 16 '21 at 07:17
  • hmm... iam also unable to replicate the issue in a sample application. Only in the projrct it appears which cant be shared here – TechnologyEnthusiast Nov 16 '21 at 07:21
  • Yep, I know that, you still need check which nuget refer to 'System.ServiceModel.Primitives, **Version=4.5.0.4**. And try to change it to available version. – Nico Zhu Nov 16 '21 at 07:23

0 Answers0