Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xsd.exe output filename

Tags:

.net

xsd

xsd.exe

Is there a way to control the output filename from xsd.exe?

My specific issue is that if an imported xsd is referenced this is added to the filename.

like image 365
NJE Avatar asked May 25 '09 09:05

NJE


2 Answers

This link suggests another alternative ... using a path character in specifying the input schemas resets the generated file name. So if you use the following you will be able to control your output file name.

xsd.exe schema1.xsd schema2.xsd .\schema3.xsd 

Will force xsd.exe to generate the schema3.cs file.

Note: It's a hack but up to now (VS 2010) it works.

like image 56
AxelEckenberger Avatar answered Sep 23 '22 02:09

AxelEckenberger


To add to AxelEckenberger's answer there is a very slight improvement on the hack if you are doing this regularly (i.e in a batch script). Create an empty schema file with the output name that you want to use

Output.xsd

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" /> 

Then you don't need to rename the output

xsd.exe schema1.xsd schema2.xsd schema3.xsd .\Output.xsd 

Now the output file will be named Output.cs.

like image 38
satnhak Avatar answered Sep 24 '22 02:09

satnhak