Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Say I have a WinForms application that I want to port to WPF/.NET 5.0 - or 6.0, it doesn't matter in this case.

Also say I am required to use a certain third party library that is used for sending data to another application via a SOAP service. It's very specific to that software and online documentation is scarce if any.

When I port my code to WPF/.NET 5.0, I get numerous error messages that all seem to be related to the System.ServiceModel library - and they seem to be impossible to figure out. Is it possible that I'm facing an impossible task?

The error messages I get are mostly variations of the two below:

"The type initializer for System.ServiceModel.Diagnostics.TraceUtility threw an exception"

"Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified."

What I have tried:

I have done some research and it appears as if the System.ServiceModel.Primitives NuGet package and its related packages would solve the issues. Alas, that did not seem to work. Neither did manually referencing all the System.ServiceModel .dll files.
Posted
Comments
Richard Deeming 2-Aug-23 3:34am    
Libraries built for .NET Framework will almost certainly not work in .NET Core / .NET 5+ applications. They would need to be built targeting .NET Standard 2.0 to work in both.

You'll either need to contact the library author for an updated version; stick to .NET Framework; or switch to a different library.
Fydobas 2-Aug-23 4:03am    
To misquote Tenacious D... the peculiar thing is this, my friend: the ERP application the library is sending data to is, almost certainly, made with .NET Core. I'm puzzled as to why the same company would only build a library for .NET Framework... I have contacted them to see if they can provide an alternative in any case
Richard Deeming 2-Aug-23 4:28am    
Big companies can be fantastically slow to update their components. For example, we deal with a Norwegian ERP system that exposes an API via a WCF service, but they use a custom compression/encryption scheme for transmitting the data, which seems to change on every release, and the library that implements it is still built for .NET Framework. 🤦‍♂️
Fydobas 2-Aug-23 5:36am    
Ugh. You know, I actually hate WinForms and its dated... everything, so much. Yet I'm forced to use it because of stuff like this. Ugh.
Richard Deeming 2-Aug-23 5:40am    
You could still use WPF with .NET Framework. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900