Skip to content

Commit 03e6596

Browse files
authored
exclude PackageOutputPath (#744)
1. DocoTask.cs (line 27): Added PackageOutputPath property. In Execute() (lines 34-38), if set, it resolves the path relative to ProjectDirectory and adds it to ExcludeDirs before the exclusion filters are built. 2. MarkdownSnippets.MsBuild.targets (line 23): Passes $(PackageOutputPath) from the MSBuild context to the task. When a project sets <PackageOutputPath>nugets</PackageOutputPath>, MSBuild passes that value to the task, which resolves it to an absolute path and adds it to the directory exclusion list — preventing the scanner from trying to read locked .nuspec/.nupkg files in that directory.
1 parent b7118dd commit 03e6596

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/MarkdownSnippets.MsBuild/DocoTask.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@ public class DocoTask :
2424
public List<string> UrlsAsSnippets { get; set; } = [];
2525
public bool? TreatMissingAsWarning { get; set; }
2626
public bool? OmitSnippetLinks { get; set; }
27+
public string? PackageOutputPath { get; set; }
2728

2829
public override bool Execute()
2930
{
3031
var stopwatch = Stopwatch.StartNew();
3132
var root = GitRepoDirectoryFinder.FindForDirectory(ProjectDirectory);
33+
34+
if (!string.IsNullOrWhiteSpace(PackageOutputPath))
35+
{
36+
var resolved = Path.GetFullPath(Path.Combine(ProjectDirectory, PackageOutputPath));
37+
ExcludeDirs.Add(resolved);
38+
}
39+
3240
var (fileConfig, configFilePath) = ConfigReader.Read(root);
3341

3442
var configResult = ConfigDefaults.Convert(

src/MarkdownSnippets.MsBuild/MarkdownSnippets.MsBuild.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<MarkdownSnippets.DocoTask
2020
ProjectDirectory="$(MSBuildProjectDirectory)"
2121
ReadOnly="$(MarkdownSnippetsReadOnly)"
22-
WriteHeader="$(MarkdownSnippetsWriteHeader)" />
22+
WriteHeader="$(MarkdownSnippetsWriteHeader)"
23+
PackageOutputPath="$(PackageOutputPath)" />
2324
</Target>
2425
</Project>

0 commit comments

Comments
 (0)