public void TestMethod1() { MSBuildWorkspace ws = MSBuildWorkspace.Create(); Project project = ws.OpenProjectAsync(@"C:\Users\Jochem\Documents\Visual Studio 2017\Projects\SEVSTools\ExampleProgram\ExampleProgram.csproj").Result; SESCriptBuilderInstance builder = new SESCriptBuilderInstance(); builder.BuildProject(project); }
public override int Run(string[] remainingArguments) { int error = 0; Console.Out.WriteLine("Starting build of project: " + this.ProjectPath); if (this.ProjectPath != null) { MSBuildWorkspace ws = MSBuildWorkspace.Create(); Project project = ws.OpenProjectAsync(this.ProjectPath).Result; if (project != null) { Console.Out.WriteLine("Project loaded..."); SESCriptBuilderInstance builder = new SESCriptBuilderInstance(); SyntaxTree result = builder.BuildProject(project, this.ProductionMode); if (result != null) { if (!this.ProductionMode) { string fullpath = System.IO.Path.Combine(this.OutputPath, BuildCommand.DefaultScriptName); System.IO.File.WriteAllText(fullpath, result.ToString()); Console.Out.WriteLine("Finished building: " + fullpath); error = 0; } else { string foldername = project.Name; string fullDirPath = System.IO.Path.Combine(this.OutputPath, foldername); System.IO.Directory.CreateDirectory(fullDirPath); string fullpath = System.IO.Path.Combine(fullDirPath, BuildCommand.DefaultScriptName); System.IO.File.WriteAllText(fullpath, result.ToString()); Console.Out.WriteLine("Finished building: " + fullpath); } } } } //Console.Out.WriteLine(this.OutputPath); return(error); }