简体   繁体   中英

Could not load file or assembly 'System.Private.ServiceModel, Version=4.1.2.4

I have two .net core projects one uses service reference to wsdl web service (third-party service), and the other is normal mvc api .net core project.

Suddenly I started to get the following error if I tried to run any unit test that reference the mvc api project.

Could not load file or assembly 'System.Private.ServiceModel, Version=4.1.2.4

This assembly is not referenced in any project whatsoever.

After a lot of search I found that .net core is trying to find this version for current build target platform (mvc api project build platform is set to Any CPU), in the following directory %USERPROFILE%\.nuget\packages\system.private.servicemodel but there is no 4.1.2.4 version in this directory, and I don't know how to specify the version of this reference because there is no reference in the projects for it.

the System.Private.ServiceModel assembly version 4.1.2.4 was shipped in WCF packages version 4.4.4 which was a .NET Core 2.0 servicing release.

This issue was fixed with the WCF packages version 4.5.0 which was part of the .NET Core 2.1 release.

So you need to update your WCF packages to the 4.5.0 version or newer. I would recommend at least the latest version released from our 2.1 branch if not our just released 3.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM