/// <summary> /// Event handler for the build event, which will silently generate the typescript files /// </summary> /// <param name="Scope">the build scope</param> /// <param name="Action">The build action</param> private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) { ThreadHelper.ThrowIfNotOnUIThread(); Workspace workspace = VsHelper.Current.GetCurrentWorkspace(); List <EnvDTE.Project> enabledProj = ConfigProcessing.GetEnabledProjectsForSolution(); if (enabledProj.Count > 0) { foreach (EnvDTE.Project proj in enabledProj) { BuildHelper.StartBuild(proj.FullName); IScriptGenEngineProvider <Workspace> provider = Imports.ScriptGenAssemblyCache.GetForProj(proj).EngineProvider; IScriptGenEngine engine = provider.GetEngine(workspace, proj.FullName); try { engine.GenerateScripts(); } catch (Exception e) { VsShellUtilities.ShowMessageBox( this, "There was an error generating script. Scripts will be generated by MSBuild. \n\n" + e.Message, "Script generation failed", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); BuildHelper.EndBuild(proj.FullName); } } } }
/// <summary> /// Occurs when the build is finished - removes the global property /// </summary> /// <param name="Scope"></param> /// <param name="Action"></param> private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action) { ThreadHelper.ThrowIfNotOnUIThread(); List <EnvDTE.Project> enabledProj = ConfigProcessing.GetEnabledProjectsForSolution(); foreach (EnvDTE.Project project in enabledProj) { BuildHelper.EndBuild(project.FullName); } }
/// <summary> /// Event handler for the build event, which will silently generate the typescript files /// </summary> /// <param name="Scope">the build scope</param> /// <param name="Action">The build action</param> private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) { ThreadHelper.ThrowIfNotOnUIThread(); Workspace workspace = VsHelper.Current.GetCurrentWorkspace(); List <EnvDTE.Project> enabledProj = ConfigProcessing.GetEnabledProjectsForSolution(); if (enabledProj.Count > 0) { foreach (EnvDTE.Project proj in enabledProj) { BuildHelper.StartBuild(proj.FullName); try { ScriptGenAssemblyCache.GetForProj(proj).GenerateScripts(workspace, proj.FullName, false); } catch (Exception e) { VsHelper.SetStatusBar("There was an error generating scripts. Scripts will be generated by MSBuild: " + e.Message); BuildHelper.EndBuild(proj.FullName); } } } }