title: Automatically generate C# from XSD in Visual Studio IDE
body: <p>I am running Visual Studio 2010. I have a <code>XSD</code> schema and want to use xsd.exe tool to generate appropriate C# file. I have done this successfully from a command line but now I want to do the same from IDE.</p>
  
  <p>Is there some well-known route for this? I have managed to use a pre-build event but I hate to have the tool running on each build. Normally, it should only run when XSD changes.</p>
  
  <p>Adding the generated .cs file to project puts it under .xsd of the same name, so the IDE knows they are related.</p>
  
  <p>I know I can set "Custom Tool" on my .xsd but I am not sure if that achieves the desired effect. I was hoping for a more straightforward way.</p>
  
  <p>And ultimately, VS2010 cannot execute XSD.EXE because it lives in the SDK folder and the path known to VS obviously does not include it.</p>
  
  <p>Any suggestions are welcome!</p>