///errorList
ErrorListProvider errorProvider = new ErrorListProvider(this);ErrorTask task = new ErrorTask();
task.Category = TaskCategory.BuildCompile;
task.ErrorCategory = TaskErrorCategory.Error;
task.Text = "hello, error window";
task.Line = 5;
task.Column = 10;
task.Document = @"c:\ini.ini";
Project prj = this.dte.Solution.Projects.Item(1);
IVsHierarchy hierarchy;
IVsSolution vsSln = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;
vsSln.GetProjectOfUniqueName(prj.UniqueName, out hierarchy);
task.HierarchyItem = hierarchy;
errorProvider.Tasks.Add(task);
其中,this是VsPackage那个类

本文介绍了一个使用Visual Studio API创建错误任务的过程。通过实例代码展示了如何设置错误任务的属性,包括类别、错误类型、文本描述、行号、列号、文档路径等,并将其添加到错误列表中。
13万+

被折叠的 条评论
为什么被折叠?



