1

console.OutputGenerated を文字列に変換しようとしていて、console.writeline("print error") を実行したいので、その方法についてアドバイスを求めています。以下は私のコードです

public void TestMain()
    {
        string projectPath = @"C:\Documents and Settings\NickyPhun\My Documents\Visual Studio 2010\Projects\MyCustomRules3\MyCustomRules3";
        string filePath = @"C:\Documents and Settings\NickyPhun\My Documents\Visual Studio 2010\Projects\MyCustomRules3\MyCustomRules3\MyCustomRules3.cs";

        StyleCopConsole console = new StyleCopConsole(null, false, null, null, true);

        CodeProject project = new CodeProject(0, projectPath, new Configuration(null));

        console.Core.Environment.AddSourceCode(project, filePath, null);
        console.OutputGenerated += OnOutputGenerated;
        console.ViolationEncountered += OnViolationEncountered;
        console.Start(new[] { project }, true);
        console.OutputGenerated -= OnOutputGenerated;
        console.ViolationEncountered -= OnViolationEncountered;

    }

    public void OnOutputGenerated(object sender, OutputEventArgs e)
    {
        Console.WriteLine(e.Output);

    }
4

0 に答える 0