Is it possible to use svcutil to reuse/exclude referenced types, as with visual studio.
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.
How can I achieve the same thing using svcutil?
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.
The reason for all this is for allowing my projects to be updated and built on a buildserver.
Edit: First of thank you for your reply and suggestion of parameters. However I'm not getting svcutil reusing the assemblies following your instructions.
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;
.....
And in the client it self:
public Address CreateNewAddress(int TK, string AddressType)
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)
(Names are scrambeled :) )
Brgds, Stian
svcutil /?
gives
/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)
So running svcutil
with /r:myassembly.dll
should make it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With