diff --git a/src/CodeAnalysis/CodeAnalysis.csproj b/src/CodeAnalysis/CodeAnalysis.csproj
index 8e15b4e3..cf2afa5e 100644
--- a/src/CodeAnalysis/CodeAnalysis.csproj
+++ b/src/CodeAnalysis/CodeAnalysis.csproj
@@ -6,6 +6,7 @@
false
analyzers/dotnet
false
+ true
@@ -16,4 +17,8 @@
+
+
+
+
diff --git a/src/CodeAnalysis/MetadataAnalyzer.cs b/src/CodeAnalysis/MetadataAnalyzer.cs
index fcb20e70..a8711f98 100644
--- a/src/CodeAnalysis/MetadataAnalyzer.cs
+++ b/src/CodeAnalysis/MetadataAnalyzer.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Immutable;
-using System.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static ThisAssembly;
@@ -25,15 +24,6 @@ class Descriptors
description: Strings.DefaultDescription.Description,
helpLinkUri: "https://learn.microsoft.com/en-us/nuget/reference/nuspec#description");
- public static readonly DiagnosticDescriptor LongDescription = new(
- Strings.LongDescription.ID,
- Strings.LongDescription.Title,
- Strings.LongDescription.Message,
- Category,
- DiagnosticSeverity.Error,
- true,
- helpLinkUri: "https://learn.microsoft.com/en-us/nuget/reference/nuspec#description");
-
public static readonly DiagnosticDescriptor MissingIcon = new(
Strings.MissingIcon.ID,
Strings.MissingIcon.Title,
@@ -122,11 +112,20 @@ class Descriptors
true,
description: SourceLinkEmbed.Description,
helpLinkUri: "https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/sourcelink");
+
+ public static readonly DiagnosticDescriptor DefaultAuthors = new(
+ Strings.DefaultAuthors.ID,
+ Strings.DefaultAuthors.Title,
+ Strings.DefaultAuthors.Message,
+ Category,
+ DiagnosticSeverity.Warning,
+ true,
+ description: Strings.DefaultAuthors.Description,
+ helpLinkUri: "https://learn.microsoft.com/en-us/nuget/reference/nuspec#authors");
}
public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(
Descriptors.DefaultDescription,
- Descriptors.LongDescription,
Descriptors.MissingIcon,
Descriptors.MissingReadme,
Descriptors.MissingLicense,
@@ -135,7 +134,8 @@ class Descriptors
Descriptors.MissingRepositoryUrl,
Descriptors.MissingProjectUrl,
Descriptors.MissingSourceLink,
- Descriptors.MissingSourceEmbed);
+ Descriptors.MissingSourceEmbed,
+ Descriptors.DefaultAuthors);
public override void Initialize(AnalysisContext context)
{
@@ -157,13 +157,17 @@ public override void Initialize(AnalysisContext context)
var sourceLinkEnabled = options.TryGetValue("build_property.EnableSourceLink", out var enableSLProp) &&
"true".Equals(enableSLProp, StringComparison.OrdinalIgnoreCase);
- if (options.TryGetValue("build_property.Description", out var description))
+ if (options.TryGetValue("build_property.Description", out var description) &&
+ description == DefaultDescription.DefaultValue)
+ {
+ ctx.ReportDiagnostic(Diagnostic.Create(Descriptors.DefaultDescription, null));
+ }
+
+ if (options.TryGetValue("build_property.Authors", out var authors) &&
+ options.TryGetValue("build_property.AssemblyName", out var assembly) &&
+ authors == assembly)
{
- if (description == DefaultDescription.DefaultValue)
- ctx.ReportDiagnostic(Diagnostic.Create(Descriptors.DefaultDescription, null));
- // There is really no way of getting such a long text in the diagnostic. We actually get an empty string.
- else if (description.Length > 4000)
- ctx.ReportDiagnostic(Diagnostic.Create(Descriptors.LongDescription, null));
+ ctx.ReportDiagnostic(Diagnostic.Create(Descriptors.DefaultAuthors, null));
}
string? packageIcon = default;
diff --git a/src/CodeAnalysis/NuGetizer.CodeAnalysis.targets b/src/CodeAnalysis/NuGetizer.CodeAnalysis.targets
new file mode 100644
index 00000000..30960f3f
--- /dev/null
+++ b/src/CodeAnalysis/NuGetizer.CodeAnalysis.targets
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/CodeAnalysis/Resources.resx b/src/CodeAnalysis/Resources.resx
index 72986f00..d2dee9ed 100644
--- a/src/CodeAnalysis/Resources.resx
+++ b/src/CodeAnalysis/Resources.resx
@@ -132,15 +132,6 @@
Default description detected
-
- NG0102
-
-
- The Description property used for the package must be up to 4000 characters long.
-
-
- Provided description is too long
-
The PackageIcon project property can specify the path to a JPEG or PNG file to use as the package icon, which will be automatically packed properly.
@@ -246,4 +237,18 @@
When EmbedUntrackedSources is set to 'true', Source Link will embed in your PDB the items that participated in the compile, but not are included in source control.
+
+ NG0102
+
+
+ Default authors detected
+
+
+ Authors metadata matches the project's AssemblyName. The value should match the profile name(s) of the actual package author(s).
+
+
+ Authors project property should contain a comma-separated list of packages authors, matching the profile names on nuget.org.
+ These are displayed in the NuGet Gallery on nuget.org and are used to cross-reference packages by the same authors.
+ Long-form description
+
\ No newline at end of file
diff --git a/src/NuGetizer.Tasks/NuGetizer.Shared.targets b/src/NuGetizer.Tasks/NuGetizer.Shared.targets
index bf7a2289..67688c70 100644
--- a/src/NuGetizer.Tasks/NuGetizer.Shared.targets
+++ b/src/NuGetizer.Tasks/NuGetizer.Shared.targets
@@ -17,6 +17,8 @@ Copyright (c) .NET Foundation. All rights reserved.
+
+
@@ -60,23 +62,6 @@ Copyright (c) .NET Foundation. All rights reserved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-