gpt4 book ai didi

.net - svcutil排除/重复使用引用的程序集

转载 作者:行者123 更新时间:2023-12-05 00:01:50 25 4
gpt4 key购买 nike

是否可以像Visual Studio一样使用svcutil重用/排除引用的类型。

我有多个项目,我的类型/数据模型存储在单独的程序集中,因此它们可以被其他非wcf项目等使用。在Visual Studio gui中更新引用时,一切都很好。只要在边框的两边都能找到类型,就可以将其从代理中定义的蜜蜂中排除。

如何使用svcutil实现同一目的?

更清楚地说,我想从dll而不是包含servicecontract的正在运行的服务生成代理。同时,我想提供包含共享类型的dll文件,这些文件应从代理中定义的beeing中排除。

所有这些的原因是允许我的项目进行更新并在buildserver上构建。

编辑:
首先,感谢您的答复和对参数的建议。但是,我不会按照您的说明重新使用svcutil。

这是我制作的.bat文件的一部分,我已排除了用于生成INotifyPropertyChanged等的所有标志。

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

结果如下:
[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)

直接在代理中生成数据模型是不正确的。客户端不只是跳过它们,而是为类型使用适当的 namespace 。正确的结果应该是:
public Jall.DataModels.Consignment.Address CreateNewAddress(int TK, string AddressType)

(名字被拼写:))

Brgds,
施蒂安

最佳答案

svcutil /?



/reference:<file path> - Add the specified assembly to the set of assemblies 
used for resolving type references. If you are
exporting or validating a service that uses 3rd-party
extensions (Behaviors, Bindings and BindingElements)
registered in config use this option to locate
extension assemblies that are not in the GAC.
(Short Form: /r)


因此,使用 svcutil运行 /r:myassembly.dll应该可以做到。

关于.net - svcutil排除/重复使用引用的程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8786096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com