public void MSB3644_CustomMessage()
        {
            var sourceDiagnostic  = new BuildErrorEventArgs("test-subcategory", "MSB3644", "foo.cs", 1, 1, 1, 1, "Reference assemblies not found!", "help-keyword", "dummy-sender");
            var msbuildDiagnostic = MSBuildDiagnostic.CreateFrom(sourceDiagnostic);

            Assert.Equal(Platform.Current.OperatingSystem != OperatingSystem.Windows
                ? ErrorMessages.ReferenceAssembliesNotFoundUnix : sourceDiagnostic.Message, msbuildDiagnostic.Message);
        }
 public MSBuildDiagnosticTag(MSBuildDiagnostic diagnostic)
     : base(
         GetErrorTypeName(diagnostic.Descriptor.Severity),
         diagnostic.GetFormattedMessage()
         )
 {
     Diagnostic = diagnostic;
 }
        public void NoImports()
        {
            var source = @"<Project></Project>";

            var expected = new MSBuildDiagnostic(
                CoreDiagnostics.NoTargets, SpanFromLineColLength(source, 1, 2, 7)
                );

            VerifyDiagnostics(source, null, true, expected);
        }
Esempio n. 4
0
 public static MSBuildDiagnosticsMessage FromDiagnostic(MSBuildDiagnostic diagnostic)
 => new MSBuildDiagnosticsMessage()
 {
     LogLevel    = diagnostic.Severity.ToString(),
     FileName    = diagnostic.File,
     Text        = diagnostic.Message,
     StartLine   = diagnostic.LineNumber,
     StartColumn = diagnostic.ColumnNumber,
     EndLine     = diagnostic.EndLineNumber,
     EndColumn   = diagnostic.EndColumnNumber
 };
Esempio n. 5
0
        public void SingleAssign()
        {
            var source = @"<Project>
  <PropertyGroup>
    <SomeOtherProp>Hello</SomeOtherProp>
    <MSBuildAllProjects>$(MSBuildThisProjectFile);$(MSBuildAllProjects)</MSBuildAllProjects>
  </PropertyGroup>
</Project>";

            var analyzer = new DoNotAssignMSBuildAllProjectsAnalyzer();

            var expected = new MSBuildDiagnostic(
                analyzer.SupportedDiagnostics[0], SpanFromLineColLength(source, 4, 5, 20)
                );

            VerifyDiagnostics(source, analyzer, expected);
        }
 public void ReportDiagnostic(MSBuildDiagnostic diagnostic)
 {
     reportDiagnostic(diagnostic);
 }
Esempio n. 7
0
 bool CoreDiagnosticFilter(MSBuildDiagnostic arg)
 => arg.Properties != null && arg.Properties.TryGetValue("Name", out var value) && (string)value == "RuntimeIdentifier";
Esempio n. 8
0
 public void RegisterCodeFix(MSBuildAction action, MSBuildDiagnostic diagnostic)
 => reportFix(action, ImmutableArray.Create(diagnostic));
 bool CoreDiagnosticFilter(MSBuildDiagnostic arg)
 => arg.Properties != null && arg.Properties.TryGetValue("Name", out var value) && (string)value == "TargetFramework";