本文整理汇总了C#中IVsOutputWindowPane.FlushToTaskList方法的典型用法代码示例。如果您正苦于以下问题:C# IVsOutputWindowPane.FlushToTaskList方法的具体用法?C# IVsOutputWindowPane.FlushToTaskList怎么用?C# IVsOutputWindowPane.FlushToTaskList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsOutputWindowPane
的用法示例。
在下文中一共展示了IVsOutputWindowPane.FlushToTaskList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildCoda
private void BuildCoda(BuildResult result, IVsOutputWindowPane output, bool shouldRepaintReferences)
{
try
{
// Now repaint references if that is needed.
// We hardly rely here on the fact the ResolveAssemblyReferences target has been run as part of the build.
// One scenario to think at is when an assembly reference is renamed on disk thus becomming unresolvable,
// but msbuild can actually resolve it.
// Another one if the project was opened only for browsing and now the user chooses to build or rebuild.
if (shouldRepaintReferences && (result.IsSuccessful))
{
this.RefreshReferences(result);
}
}
finally
{
try
{
ErrorHandler.ThrowOnFailure(output.FlushToTaskList());
}
finally
{
NotifyBuildEnd(result.IsSuccessful);
}
}
}
示例2: Build
private void Build(uint options, IVsOutputWindowPane output, string target)
{
if (!this.config.ProjectMgr.HasPassedSecurityChecks)
{
// From a security perspective, if there was something truly malicious about the project,
// the user is about to toast himself by requesting a build. Any further attempts at
// preventing damage by avoiding MSBuild targets/tasks are futile. So, from this point
// forward, we might as well pretend that this project has passed all security checks,
// and we're free to run any targets we like.
this.config.ProjectMgr.HasPassedSecurityChecks = true;
}
// We want to refresh the references if we are building with the Build or Rebuild target or if the project was opened for browsing only.
bool shouldRepaintReferences = (target == null || target == MsBuildTarget.Build || target == MsBuildTarget.Rebuild
|| !this.config.ProjectMgr.HasPassedSecurityChecks);
int shouldContinue = 1;
foreach (IVsBuildStatusCallback cb in callbacks)
{
try
{
ErrorHandler.ThrowOnFailure(cb.BuildBegin(ref shouldContinue));
if (shouldContinue == 0)
return;
}
catch (Exception e)
{
// If those who ask for status have bugs in their code it should not prevent the build/notification from happening
Debug.Fail(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.BuildEventError, CultureInfo.CurrentUICulture), e.Message));
}
}
MSBuildResult result = MSBuildResult.Failed;
try
{
result = config.ProjectMgr.Build(options, this.config.ConfigName, output, target);
}
catch (Exception e)
{
Trace.WriteLine("Exception : " + e.Message);
ErrorHandler.ThrowOnFailure(output.OutputStringThreadSafe("Unhandled Exception:" + e.Message + "\n"));
throw e;
}
finally
{
int success = ((result == MSBuildResult.Successful) ? 1 : 0);
foreach (IVsBuildStatusCallback cb in callbacks)
{
try
{
ErrorHandler.ThrowOnFailure(cb.BuildEnd(success));
}
catch (Exception e)
{
// If those who ask for status have bugs in their code it should not prevent the build/notification from happening
Debug.Fail(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.BuildEventError, CultureInfo.CurrentUICulture), e.Message));
}
}
ErrorHandler.ThrowOnFailure(output.FlushToTaskList());
// Now repaint references if that is needed.
// We hardly rely here on the fact the ResolveAssemblyReferences target has been run as part of the build.
// One scenario to think at is when an assembly reference is renamed on disk thus becomming unresolvable,
// but msbuild can actually resolve it.
// Another one if the project was opened only for browsing and now the user chooses to build or rebuild.
if (shouldRepaintReferences && (result == MSBuildResult.Successful))
{
this.RefreshReferences();
}
}
}
示例3: Build
private void Build(uint options, IVsOutputWindowPane output, string target) {
if (!this.NotifyBuildBegin()) {
return;
}
try {
config.ProjectMgr.BuildAsync(options, this.config.ConfigName, output, target, (result, buildTarget) => this.NotifyBuildEnd(result, buildTarget));
} catch (Exception e) {
if (e.IsCriticalException()) {
throw;
}
Trace.WriteLine("Exception : " + e.Message);
ErrorHandler.ThrowOnFailure(output.OutputStringThreadSafe("Unhandled Exception:" + e.Message + "\n"));
this.NotifyBuildEnd(MSBuildResult.Failed, target);
throw;
} finally {
ErrorHandler.ThrowOnFailure(output.FlushToTaskList());
}
}
示例4: ObsoleteBuild
public virtual bool ObsoleteBuild(uint vsopts, string config, IVsOutputWindowPane output, bool fCleanBuild)
{
if (fCleanBuild)
{
// we are done
return true;
}
lock (Project.BuildLock)
{
ProjectOptions options = this.GetProjectOptions(config);
CompilerResults results;
ArrayList files = new ArrayList();
/*UNDONE: need to get this to use MSBuild
foreach (XmlElement e in doc.SelectNodes("//Files/Include/File"))
{
//TODO: Support other "BuildActions" like "EmbeddedResource"...
if (e.GetAttribute("BuildAction") == "Compile")
{
string rel = e.GetAttribute("RelPath");
Url url = new Url(new Url(doc.BaseURI), rel);
files.Add(url.AbsoluteUrl);
}
}
*/
try
{
ICodeCompiler compiler = this.GetCompiler();
if (files.Count == 1)
{
string filename = (string)files[0];
results = compiler.CompileAssemblyFromFile(options, filename);
}
else
{
string[] fileNames = (string[])files.ToArray(typeof(string));
results = compiler.CompileAssemblyFromFileBatch(options, fileNames);
}
}
catch (Exception e)
{
results = new CompilerResults(options.TempFiles);
results.Errors.Add(new CompilerError(options.OutputAssembly, 1, 1, "", "Internal Compiler Error: " + e.ToString() + "\n"));
results.NativeCompilerReturnValue = 1;
}
taskProvider.Tasks.Clear();
int errorCount = 0;
int warningCount = 0;
foreach (CompilerError e in results.Errors)
{
if (e.IsWarning) warningCount++;
else
errorCount++;
NativeMethods.ThrowOnFailure(output.OutputTaskItemString(GetFormattedErrorMessage(e, false) + "\n", VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, "", -1, e.FileName, (uint)e.Line - 1, e.ErrorText));
}
NativeMethods.ThrowOnFailure(output.OutputStringThreadSafe("Build complete -- " + errorCount + " errors, " + warningCount + " warnings")); //TODO: globalize
NativeMethods.ThrowOnFailure(output.FlushToTaskList());
return results.NativeCompilerReturnValue == 0;
}
}
示例5: Build
//////////////////////////////////////////////////////////////////////////////////////////////////
// This is called from the compiler background thread.
// fCleanBuild is not part of the vsopts, but passed down as the callpath is differently
//
//////////////////////////////////////////////////////////////////////////////////////////////////
/// <include file='doc\Project.uex' path='docs/doc[@for="Project.Build"]/*' />
public virtual bool Build(uint vsopts, XmlElement config, IVsOutputWindowPane output, bool fCleanBuild){
if (fCleanBuild){
// we are done
return true;
}
lock (Project.BuildLock){
#if LookForMemoryLeaks
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
long usedMemoryBeforeBuild = System.GC.GetTotalMemory(true);
#endif
int errorCount = 0;
int warningCount = 0;
CompilerResults results = this.CompileProject(config);
#if WHIDBEY
if (this.taskManager != null && this.taskManagerBuild != null) {
taskManager.ClearTasksOnProject(this.Caption);
taskManagerBuild.ClearTasksOnProject(this.Caption);
bool runVerifierBuildOnly = this.GetBoolAttr(config, "RunProgramVerifier") && !this.GetBoolAttr(config, "RunProgramVerifierWhileEditing");
string verifierCode = ((int)System.Compiler.Error.GenericWarning).ToString("0000");
foreach (CompilerError e in results.Errors) {
if (e.IsWarning)
warningCount++;
else
errorCount++;
// output.OutputTaskItemString(GetFormattedErrorMessage(e, false) + "\n", VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, "", -1, e.FileName, (uint)e.Line - 1, e.ErrorText);
int endLine;
int endColumn;
if (e is System.Compiler.CompilerErrorEx) {
System.Compiler.CompilerErrorEx errorEx = (System.Compiler.CompilerErrorEx)e;
endLine = errorEx.EndLine;
endColumn = errorEx.EndColumn;
}
else {
endLine = e.Line;
endColumn = e.Column + 1;
}
bool isBuildOnly = runVerifierBuildOnly && e.ErrorNumber == verifierCode;
(isBuildOnly ? taskManagerBuild : taskManager).AddTask(e.ErrorText, null, e.ErrorNumber, "CS" + e.ErrorNumber,
TaskPriority.Normal, (e.IsWarning ? TaskCategory.Warning : TaskCategory.Error),
(isBuildOnly ? TaskMarker.Error : (e.IsWarning ? TaskMarker.Warning : TaskMarker.CodeSense)),
TaskOutputPane.Build, this.Caption, e.FileName,
e.Line, e.Column, endLine, endColumn, null);
}
taskManager.OutputString("Build complete -- " + errorCount + " errors, " + warningCount + " warnings\n", TaskOutputPane.Build);
taskManager.Refresh();
taskManagerBuild.Refresh();
}
else {
#endif
this.taskProvider.ClearErrors();
foreach (CompilerError e in results.Errors) {
if (e.IsWarning) warningCount++;
else
errorCount++;
output.OutputTaskItemString(GetFormattedErrorMessage(e, false) + "\n", VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, "", -1, e.FileName, (uint)e.Line - 1, e.ErrorText);
}
output.OutputStringThreadSafe("Build complete -- " + errorCount + " errors, " + warningCount + " warnings\n"); //TODO: globalize
output.FlushToTaskList();
#if WHIDBEY
}
#endif
bool success = results.NativeCompilerReturnValue == 0;
#if LookForMemoryLeaks
results = null;
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
long usedMemoryAfterBuild = System.GC.GetTotalMemory(true);
output.OutputStringThreadSafe("Build leaked "+(usedMemoryAfterBuild-usedMemoryBeforeBuild)+" bytes");
#endif
return success;
}
}
示例6: Build
private void Build(uint options, IVsOutputWindowPane output, string target)
{
int shouldContinue = 1;
foreach (IVsBuildStatusCallback cb in callbacks)
{
try
{
ErrorHandler.ThrowOnFailure(cb.BuildBegin(ref shouldContinue));
if (shouldContinue == 0)
return;
}
catch (Exception e)
{
// If those who ask for status have bugs in their code it should not prevent the build/notification from happening
Debug.Fail(String.Format("Exception was thrown during BuildBegin event\n{0}", e.Message));
}
}
MSBuildResult result = MSBuildResult.Failed;
try
{
result = config.ProjectMgr.Build(options, this.config.ConfigName, output, target);
}
catch (Exception e)
{
Trace.WriteLine("Exception : " + e.Message);
ErrorHandler.ThrowOnFailure(output.OutputStringThreadSafe("Unhandled Exception:" + e.Message + "\n"));
throw e;
}
finally
{
int success = ((result == MSBuildResult.Sucessful) ? 1 : 0);
foreach (IVsBuildStatusCallback cb in callbacks)
{
try
{
ErrorHandler.ThrowOnFailure(cb.BuildEnd(success));
}
catch (Exception e)
{
// If those who ask for status have bugs in their code it should not prevent the build/notification from happening
Debug.Fail(String.Format("Exception was thrown during BuildEnd event\n{0}", e.Message));
}
}
ErrorHandler.ThrowOnFailure(output.FlushToTaskList());
}
}