1

I normally convert the xsd files to .cs using Developer command prompt xsd.exe /c ABC.xsd

Is there some way I can create a .bat file for this conversion it will help us to convert 14-15 files daily

Shah Jigesh
  • 51
  • 11

1 Answers1

1

I'm not sure about batch, but a simple c# program should do the trick. You may need to edit the working directory to point to the path of your xsd.exe

using System;
using System.Diagnostics;
using System.IO;

namespace XSD2CS
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter xsd file: ");
            string xsdFile = Console.ReadLine();

            if (!File.Exists(xsdFile)) {
                Console.WriteLine("Error. File doesn't exists.");
                Environment.Exit(1);
            }

            Process p = new Process();
            p.StartInfo.FileName = "XSD.exe";
            p.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin";
            p.StartInfo.Arguments = "/c " + xsdFile;

            p.Start();
        }
    }
}
Bobby R
  • 91
  • 1
  • 6