Skip to content

Commit

Permalink
More specific diagnostic message for invalid NuGet version
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutch committed Apr 17, 2024
1 parent 136a024 commit bacc18d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions MonoDevelop.MSBuild/Language/CoreDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ class CoreDiagnostics
"The value `{0}` is not a valid suffixed version format",
MSBuildDiagnosticSeverity.Error);

public const string InvalidNuGetVersionExpression_Id = nameof (InvalidNuGetVersionExpression);
public static readonly MSBuildDiagnosticDescriptor InvalidNuGetVersionExpression = new (
InvalidNuGetVersionExpression_Id,
"Invalid NuGet version expression",
"The value `{0}` is not a valid NuGet version or version expression.",
MSBuildDiagnosticSeverity.Error);

public const string InvalidClrNamespace_Id = nameof (InvalidClrNamespace);
public static readonly MSBuildDiagnosticDescriptor InvalidClrNamespace = new (
InvalidClrNamespace_Id,
Expand Down
2 changes: 1 addition & 1 deletion MonoDevelop.MSBuild/Language/MSBuildDocumentValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ void VisitPureLiteral (MSBuildElementSyntax elementSymbol, MSBuildAttributeSynta
break;
case MSBuildValueKind.NuGetVersion:
if (!NuGet.Versioning.VersionRange.TryParse (value, out _)) {
AddErrorWithArgs (CoreDiagnostics.InvalidVersionSuffixed, value);
AddErrorWithArgs (CoreDiagnostics.InvalidNuGetVersionExpression, value);
}
break;
case MSBuildValueKind.VersionSuffixed:
Expand Down

0 comments on commit bacc18d

Please sign in to comment.