Martina
Martina

Reputation: 1918

Could not load file or assembly 'System.Web.Services from Blazor project

I have a blazor project in .NET 6.0

I need to call a SOAP WebService (guide here)

What I do is to import WSDL as Connected Service in another project of my solution with target framework NET4.8

The solution builds correctly, but when I debug and I try to call the method from blazor app I have the following error

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context

Now, I suppose it's a .NET version compatibility problem, but how I can solve it?

EDIT

I try creating a new project .NET 6.0 and adding Connected service. Calling the method from my blazor (.NET 6.0) project and I have the same error. Probably the web service use something that is incompatible?

Thanks in advance

Upvotes: 1

Views: 577

Answers (1)

Marvin Klein
Marvin Klein

Reputation: 1746

Try to add a reference to the NuGet Package System.Windows.Compatibility

Upvotes: -1

Related Questions