public override async void StartBuild() { var options = new BuildOptions(BuildTarget.Rebuild); options.TargetForDependencies = BuildTarget.Build; options.ProjectAdditionalProperties["RunSourceAnalysis"] = "true"; options.ProjectAdditionalProperties["StyleCopFile"] = StyleCopWrapper.FindStyleCopPath() ?? string.Empty; CallbackMethod(await SD.BuildService.BuildAsync(this.ProjectToBuild, options)); }
public override void StartBuild() { BuildOptions options = new BuildOptions(BuildTarget.Rebuild, CallbackMethod); options.TargetForDependencies = BuildTarget.Build; options.ProjectAdditionalProperties["RunSourceAnalysis"] = "true"; options.ProjectAdditionalProperties["StyleCopFile"] = StyleCopWrapper.FindStyleCopPath() ?? string.Empty; BuildEngine.BuildInGui(this.ProjectToBuild, options); }
protected override void Load(MSBuildBasedProject project, string configuration, string platform) { base.Load(project, configuration, platform); if (String.IsNullOrEmpty(SourceAnalysisOverrideSettingsFile.Value)) { SourceAnalysisOverrideSettingsFile.Value = StyleCopWrapper.GetMasterSettingsFile(); SourceAnalysisOverrideSettingsFile.Location = PropertyStorageLocations.Base; IsDirty = false; } }
private string CopyFromMaster() { var newSettingsFile = Project.Directory + "\\Settings.SourceAnalysis"; System.IO.File.Copy( StyleCopWrapper.GetMasterSettingsFile(), newSettingsFile, true ); SourceAnalysisOverrideSettingsFile.Value = newSettingsFile; SourceAnalysisOverrideSettingsFile.Location = PropertyStorageLocations.Base; return(newSettingsFile); }
void ModifyStyleCopSettings_Click(object sender, RoutedEventArgs e) { var settingsFile = SourceAnalysisOverrideSettingsFile.Value; if (settingsFile == StyleCopWrapper.GetMasterSettingsFile()) { if (ConfirmSwitchFromMaster()) { settingsFile = CopyFromMaster(); } } if (!System.IO.File.Exists(settingsFile)) { if (ConfirmReplaceMissingFile()) { settingsFile = CopyFromMaster(); } else { MessageService.ShowWarning("No settings file found to modify."); return; } } string styleCopPath = StyleCopWrapper.FindStyleCopPath(); string executable; if (styleCopPath != null) { executable = Path.Combine(Path.GetDirectoryName(styleCopPath), "StyleCopSettingsEditor.exe"); } else { executable = null; } string parameters = "\"" + settingsFile + "\""; if (!File.Exists(executable)) { LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable); MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options."); return; } using (Process p = Process.Start("\"" + executable + "\"", parameters)) { // No need to wait for the settings dialog to close - we can leave it open. } }
private void ShowStatus() { string path = StyleCopWrapper.FindStyleCopPath(); if (path == null) { status.Text = StringParser.Parse("StyleCop not found in the given path."); EnableModifyStyleCopSettings = false; } else { status.Text = StringParser.Parse("StyleCop was found in: ") + Environment.NewLine + path; EnableModifyStyleCopSettings = true; } }
void ModifyStyleCopSettings_Click(object sender, RoutedEventArgs e) { var executable = Path.Combine(Path.GetDirectoryName(StyleCopWrapper.FindStyleCopPath()), "StyleCopSettingsEditor.exe"); var parameters = "\"" + StyleCopWrapper.GetMasterSettingsFile() + "\""; if (!File.Exists(executable)) { LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable); MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options."); return; } using (Process p = Process.Start("\"" + executable + "\"", parameters)) { // No need to wait for the settings dialog to close - we can leave it open. } }
private void FindStyleCopPath_Click(object sender, System.Windows.RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = "dll"; dlg.Filter = StringParser.Parse("StyleCop|*" + StyleCopWrapper.STYLE_COP_FILE + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); if (dlg.ShowDialog() == true) { string path = dlg.FileName; if (StyleCopWrapper.IsStyleCopPath(path)) { StyleCopPath = path; } else { MessageService.ShowError(string.Format("Directory does not contain StyleCop (*{0}).", StyleCopWrapper.STYLE_COP_FILE)); } } ShowStatus(); }