Not sure what the appropriate tags are here...
A while back I created a batch script which, when run will convert all .xsd files found in C:\api\ into C# classes using the xsd.exe file found in the Microsoft Windows SDK (using v6.1 here).
@ECHO OFF
CLS
ECHO ***
ECHO Runs xsd.exe on all *.xsd files sorted by filename in the current folder.
ECHO ***
FOR /R "C:\api" %%G IN (*.xsd) DO (
@ECHO ON
"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\xsd.exe" "C:\api\base\base.xsd" "%%G" /c /n:Mynamespace /o:"C:\api"
@ECHO OFF
)
The problem is this... I have 50 or so generated .cs files, including the base class. And inside every single one, it generates a copy of the base class, so I end up with the base class in every class, when I only need it in one.
Is there a way of preventing the class being generated without the base class in each one? I still want the base class to be created (base.cs), but just not in the other 49 classes.
Edit:
I have tried the following:
@ECHO OFF
SET str1=
FOR /R "C:\api" %%G IN (*.xsd) DO (
SET str1="%%G" %str1%
)
ECHO %str1%
The response returned is always the last file in the list.