1

I have seen this question before (here for one), however the solution is to not reuse referenced assemblies. I need to reuse included assemblies because multiple services reference the same shared Objects. If I do not reuse the assemblies I get namespace errors because the same Object is referenced through different namespaces. (ie. Service1.Object, Service2.Object)

In short, I need the generated Client class that extends the ClientBase for the web service but I cannot untick the reuse referenced assemblies as I need shared Objects with the same namespace. Any suggestions?

1

2 Answers 2

1

You can generate your client proxy with svcutil.exe and use the /r switch to specify assemblies that you want referenced instead of re-emitted in the auto-generated client proxy code.

  • ProjACommon
  • ProjBSvc
    • References ProjACommon
  • ProjCClient
    • References ProjACommon
    • You want a client that references ProjA types and/or code rather than them being auto-generated into a new namespace within C

After building ProjBSvc exec the following, which outputs .wsdl & .xsd

svcutil.exe ProjBSvc.dll

2nd consume the wsdl & xsd to generate a proxy/client:

svcutil.exe *.wsdl *.xsd /o:<ProjCClientPath>/Client.cs /r:ProjACommon.dll

ProjCClient references Client.cs generated from previous steps

Build and examine with the object browser and you will see the types in C referencing the types in A instead of new types with the same name in C's namespace. You may want /tcv and /n as well as other switches to meet your needs.

Here is an article that may help. It also links to the Microsoft documentation for svcutil

Sign up to request clarification or add additional context in comments.

1 Comment

Can you reference a good example or link where I can get more details on this?
0

Use a mapper, meaning you will have to duplicate the models(objects) and have a class the maps the objects from one namespace to the next.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.