为什么 svcutil.exe 的/reference 选项不起作用? [英] Why doesn't the /reference option to svcutil.exe work?

查看:20
本文介绍了为什么 svcutil.exe 的/reference 选项不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 svcutil.exe 从一组 .wsdl 文件中仅生成服务合同(接口).当我这样做时(从 http 托管的 wsdl),它会选择包含的模式并为它们生成所有代码.

I'm attempting to use svcutil.exe to generate -only- the service contracts (interfaces) from a set of .wsdl files. When I do this (from an http-hosted wsdl), it picks up the included schemas and generates all the code for them.

太好了.

真的想做的是使用一组已经使用 xsd.exe 工具从架构文件生成的类(这样做的原因并不重要,足够了说我需要在一个程序集中拥有类型,而在另一个程序集中拥有服务合同).我成功地生成了一个包含所有类型的程序集.

What I would REALLY like to do, however, is to use a set of classes already generated from the schema files using the xsd.exe tool (the reasons for this are not important, suffice it to say that I need to have the types in one assembly, and the service contracts in another). I was successful in generating an assembly containing all the types.

当我尝试让 svcutil.exe 使用该程序集中的类型时出现问题.我的命令行看起来像这样:

The problem occurs when I attempt to get svcutil.exe to use the types in that assembly. My command line looks something like this:

svcutil /target:code /noconfig /reference:my_types.dll http://path/to/wsdl

这工作正常,但生成的代码包含 my_types.dll 文件中所有类型的重复项.我从 svcutil.exe 的文档中了解到,这正是/reference: 参数旨在克服的问题.但是,就我而言,它不起作用.

This works fine, but the generated code contains duplicates of all the types in the my_types.dll file. It is my understanding from the documentation for svcutil.exe that this is the exact problem that the /reference: parameter is meant to overcome. In my case, however, it is not working.

为什么?

推荐答案

显然它只适用于 DataContract 类型,而不适用于 XmlSerializer 类型.

Apparently it only works for DataContract types and not XmlSerializer types.

链接

这篇关于为什么 svcutil.exe 的/reference 选项不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆