开发者

SvcUtil and /dconly generates XSD's for data types NOT marked with the DataContract attribute

开发者 https://www.devze.com 2023-02-09 03:39 出处:网络
Has anyone ever encountered a problem with Svcutil and the /dconly option where it generates metadata for EVERY data type in an Assembly, even if it is NOT marked with with the [DataContract()] attrib

Has anyone ever encountered a problem with Svcutil and the /dconly option where it generates metadata for EVERY data type in an Assembly, even if it is NOT marked with with the [DataContract()] attribute? It also appears to be generating metadata for types only referenced in the code, such as XmlDictionaryReaderQuotas even though these are not a part of the physical assembly that I generated metadata on.

Some info: Using the .NET 4.0 version of SvcUtil. Does not matter if class is empty or not. No references are specified in the command line for SvcUtil.

Command line:

"C:\In Progress Work (Prospective)\Prospective Serv开发者_开发知识库er\Prospective Server\Management\Prospective.Server.Server.NET40.Debug.AnyCPU.dll" /nologo /t:metadata /d:"C:\In Progress Work (Prospective)\Prospective Server\Prospective Server\Management" /dconly


The work-around is to explicitly specify which XSD's to use. In my case that could still be enough to overflow the character limit for the command line; instead I wrote some code that deletes all the extra XSD's and continue to use *.xsd on the SvcUtil command. However, this can be tricky as it requires detailed knowledge of every WCF namespace in the assembly.

I have filed a bug report with Microsoft as this behavior is not defined as correct in any of their publicly available documentation. You can view the bug report and vote it up here: http://connect.microsoft.com/wcf/feedback/details/641777/svcuil-with-datacontractonly-generates-xsds-for-all-types-in-assembly-regardless-of-datacontract-attributes

0

精彩评论

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