开发者

svcutil.exe excludetypes problem

开发者 https://www.devze.com 2022-12-30 08:53 出处:网络
My service uses a type Foo defined in another DLL, and my client also uses that DLL to get that type.Rather than generating a proxy class for that type, I\'d like the proxy code to just refer to the r

My service uses a type Foo defined in another DLL, and my client also uses that DLL to get that type. Rather than generating a proxy class for that type, I'd like the proxy code to just refer to the real type. I can accomplish this manually by generating the proxy with WSDL.EXE on the running service, manually editing out the partial class Foo definition from it, and adding a Using statement. I'd like to do it without hand-editing if possible.

It seems like maybe the answer is to use SVCUTIL.EXE instead of WSDL.EXE. There are t开发者_JAVA百科wo intriguing options: /R and /ET. I tried putting /ET:Foo and /ET:My.FQN.Util.Foo, and /ET:www.my.com.the.servicenamespace.Foo, and also adding the DLL filename to the option. But nothing changes in the ServiceWithFoos.cs proxy class that gets created. The partial class definition for Foo is still there.

Am I on the right track? What am I doing wrong?


Add [DataContract(Namespace = "http://anything.here")] to your Foo type, then use svcutil with the /r option taking the path of the library containing Foo. This way svcutil should see the same contract namespace and map Foo correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消