public static int Main(string[] args) { #if DEBUG // This is useful in debugging unit tests that run an instance of scaffold.exe if (File.Exists("scaffold.exe.breakonentry.flag")) Debugger.Break(); #endif ScaffoldTool scaffold = new ScaffoldTool(new ConsoleOutputter()); // Get any settings from the .config file if (!((IProcessConfiguration)scaffold).ProcessConfiguration(ConfigurationUserLevel.None)) { return 1; } // Get any environment variable settings if (!((IProcessEnvironment)scaffold).ProcessEnvironment()) { return 1; } // Get all the command line arguments if (!((IProcessCommandLine)scaffold).ProcessCommandLine(args)) { return 1; } try { scaffold.Execute(); } catch (Exception e) { // Log any exceptions that slip through, typically happens when // debugging or if the Execute method cannot be jitted. scaffold.Output.Error(e.ToString()); return 1; } return 0; }
public void TestScaffoldClass() { ScaffoldTool scaffold = new ScaffoldTool(new TraceOutputter()); // TODO-johnls-1/2/2008: This property is really just a hack scaffold.NoRemoting = true; scaffold.ScriptPath = new ParsedPath("HelloWorld.csr", PathType.File); System.Threading.Thread t = new System.Threading.Thread(delegate() { EnvDTE._DTE dte = null; while ((dte = GetIDEInstances("HelloWorld.sln")) == null) { System.Threading.Thread.Sleep(100); } dte.Application.Quit(); }); t.Start(); scaffold.Execute(); if (scaffold.Output.HasOutputErrors) { t.Abort(); } else { if (!t.Join(10000)) { t.Abort(); } } Assert.IsFalse(scaffold.Output.HasOutputErrors, "Scaffold failed"); }