What does this WCF error mean: “Custom tool warning: Cannot import wsdl:portType”

后端 未结 13 1832
难免孤独
难免孤独 2020-11-29 17:38

I created a WCF service library project in my solution, and have service references to this. I use the services from a class library, so I have references from my WPF applic

13条回答
  •  无人及你
    2020-11-29 18:23

    For anyone here in the future, I had the same error but caused by version issues, in two different ways.

    I have two WCF services and two client applications that talk via the service references. I updated a nuget package on both sides and tried to update the service reference and got this error.

    Deleting didn't help. Unchecking "reuse assemblies" is not desired as I need to reuse them - that's the whole point.

    In the end, there were two separate issues:

    1) The first issue, I believe, was a visual studio caching issue. I meticulously went over all of the references and found no issues but it still reported being unable to find the previous version of the file. I uninstalled all of the nuget packages, restarted visual studio, and reinstalled them. Updating the service reference worked.

    2) The second issue was caused by a dependency issue. I updated the nuget package on both sides and everything appeared correct, but an unmarked dependency was out of sync. Example:

    Package Foo v1 references Bar v1. It is possible to update Foo and Bar to v2 independently without updating the reference. If you install both Foo and Bar v2 the service reference tool will scan Foo v2, see the reference to Bar v1, and fail because it can't find the older version. This is only reported correctly if you update the version numbers of your dll for every package. Visual Studio and MSBuild will have no problem building the application but the service reference will have a terrible time trying to resolve everything.

    I hope this helps someone.

提交回复
热议问题