SvcUtil工具exlude /再利用refrenced组件 [英] svcutil exlude/reuse refrenced assemblies

查看:147
本文介绍了SvcUtil工具exlude /再利用refrenced组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使用SvcUtil工具重用/排除引用类型,与Visual Studio。

Is it possible to use svcutil to reuse/exclude referenced types, as with visual studio.

我有多个项目,我的类型/ datamodels都存储在单独的组件,这样他们就可以当在Visual Studio GUI更新refrences被其他非WCF项目等等,这一切工作只是罚款。只要一个类型是在边界两侧的发现,它的排除在代理beeing限定。

I have multiple projects, my types/datamodels are stored in separate assemblies, so they can be used by other non wcf projects etc. When updating refrences in the visual studio gui, this all works out just fine. As long as a type is found on both sides of the border, it's excluded from beeing defined in the proxy.

我怎样才能做到同样的事情用SvcUtil工具?

How can I achieve the same thing using svcutil?

更清楚我想要生成一个DLL,不包含的ServiceContract运行中的服务代理。同时,我要养活包含共享类型,应排除在代理beeing定义的dll文件。

More clearly I want to generate the proxy from a dll, not a running service which contains the servicecontract. At the same time I want to feed the dll files containing the shared types, which should be excluded from beeing defined in the proxy.

原因这一切都是为了让我的项目进行更新,并建立在一个buildserver。

The reason for all this is for allowing my projects to be updated and built on a buildserver.

编辑: 首先感谢您对参数的答复和建议。不过我没有收到SvcUtil工具重用组件下面的说明。

First of thank you for your reply and suggestion of parameters. However I'm not getting svcutil reusing the assemblies following your instructions.

下面是.bat文件的部分我做了我已经排除了所有的标志产生INotifyPropertyChanged的等。

Here is parts of the .bat file I made I've excluded all the flags for generating INotifyPropertyChanged etc.

SET BACKENDROOT=C:\SomePath\Development\Backend\bin
SET DATAMODELSBASE=C:\SomePath\Development\DataModels\bin
SET COMMONBASE=C:\SomePath\Development\Common\bin

SET REFRENCED_ASSEMBLIES=/r:%DATAMODELSBASE%\Jall.DataModels.Consignment.dll

svcutil %BACKENDROOT%\Jall.Backend.Consignment.DLL /t:metadata
svcutil /o:test.cs %REFRENCED_ASSEMBLIES% *.wsdl *.xsd

的结果如下:

The result is as follows:

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
   [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/KSD.DataModels.Consignment")]
public partial class ExtInvoice : OrmBase
{

private System.DateTime buyersOrderDateField;

private bool buyersOrderDateFieldSpecified;

private string buyersOrderNumberField;

private string compCodeField;
.....

和客户端它的自我:

public Address CreateNewAddress(int TK, string AddressType)

这是不正确的datamodels直接在代理中产生。客户端不只是跳过他们,并使用正确的命名空间的类型。正确的结果应该是:

This is incorrect the datamodels are generated directly in the proxy. The client doesn't just skip them and use the proper namespace for the types. The correct result should be:

public Jall.DataModels.Consignment.Address CreateNewAddress(int TK, string AddressType)

(名称是scrambeled :))

(Names are scrambeled :) )

Brgds, 了Stian

Brgds, Stian

推荐答案

感谢您的帮助。 得到了这个工作,最终用下面的命令:

Thanks for your help. Got this working eventually with the following commands:

SET BACKENDROOT=C:\SomePath\Development\Backend\bin
SET DATAMODELSBASE=C:\SomePath\Development\DataModels\bin
SET OUTFOLDER=C:\SomeOutputFolder
SET REFRENCED_ASSEMBLIES=/r:%DATAMODELSBASE%\Jall.DataModels.Consignment.dll
SET REFRENCED_ASSEMBLIES=%REFRENCED_ASSEMBLIES% /r:%DATAMODELSBASE%\Jall.DataModels.SomethingElse.dll

SET SVCFLAGS=/enableDataBinding /s /a /tcv:Version35

::Generate metadata
svcutil %BACKENDROOT%\Jall.Backend.Consignment.DLL /t:metadata -d:%OUTPUTFOLDER%

::Generate proxy with shared types
svcutil %OUTPUTFOLDER%\*.wsdl %OUTPUTFOLDER%\*.xsd %SVCFLAGS% /ser:DataContractSerializer %REFERENCED_ASSEMBLIES /o:test.cs

请注意,该/串:DataContractSerializer的不得不被用于这个工作。 而另一个烦恼是,如果类型,如数据表/数据集等被使用(而不是他们真的应该虽然)及其零组件已被列入或SvcUtil工具会搞乱生成的元数据。

Note that the /ser:DataContractSerializer had to be used for this to work. And another annoyance is that if types such as datatables/datasets etc is used (not that they really should though) their assemblies have to be included or svcutil will mess up generating the metadata.

IE浏览器:

SET SHAREDASSEMBLIES=%SHAREDASSEMBLIES% /r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll

这篇关于SvcUtil工具exlude /再利用refrenced组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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