[GH-ISSUE #96] Fails to ignore package dlls if %NUGET_PACKAGES% is set to a different format of path. #81

Closed
opened 2026-02-25 21:30:37 +03:00 by kerem · 2 comments
Owner

Originally created by @CZEMacLeod on GitHub (Jul 16, 2023).
Original GitHub issue: https://github.com/brutaldev/StrongNameSigner/issues/96

Originally assigned to: @brutaldev on GitHub.

If I globally set the environment variable NUGET_PACKAGES to something like S:\Packages*, the task does not ignore the DLLs from packages any more.

*in my case having moved my packages to a DevDrive, or C:\azp\packages on my azure devops build server.

There is some code with hardcoded possible paths here github.com/brutaldev/StrongNameSigner@4a96c7855e/src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs (L77)

I think the base path for nuget packages should probably be a parameter or perhaps an itemgroup array that can be passed in, with a default value of NUGET_PACKAGES if set...
There is a property RestorePackagesPath which can be set too which should probably be respected.

This would allow a consumer to specify any additional directories etc. that are used as restore sources.

I think on new SDK projects, there is a property generated in xxx.csproj.nuget.g.props which has all the package folders: NuGetPackageFolders

    <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">S:\NuGetPackages;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages;C:\Program Files (x86)\Microsoft\Xamarin\NuGet\</NuGetPackageFolders>

Would you consider a PR to implement this?

Originally created by @CZEMacLeod on GitHub (Jul 16, 2023). Original GitHub issue: https://github.com/brutaldev/StrongNameSigner/issues/96 Originally assigned to: @brutaldev on GitHub. If I globally set the environment variable `NUGET_PACKAGES` to something like `S:\Packages`*, the task does not ignore the DLLs from packages any more. *in my case having moved my packages to a DevDrive, or `C:\azp\packages` on my azure devops build server. There is some code with hardcoded possible paths here https://github.com/brutaldev/StrongNameSigner/blob/4a96c7855e364ece9496a00aa9e312a9659a4dee/src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs#L77 I think the base path for nuget packages should probably be a parameter or perhaps an itemgroup array that can be passed in, with a default value of `NUGET_PACKAGES` if set... There is a property `RestorePackagesPath` which can be set too which should probably be respected. This would allow a consumer to specify any additional directories etc. that are used as restore sources. I think on new SDK projects, there is a property generated in `xxx.csproj.nuget.g.props` which has all the package folders: `NuGetPackageFolders` ```xml <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">S:\NuGetPackages;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages;C:\Program Files (x86)\Microsoft\Xamarin\NuGet\</NuGetPackageFolders> ``` Would you consider a PR to implement this?
kerem 2026-02-25 21:30:37 +03:00
Author
Owner

@CZEMacLeod commented on GitHub (Jul 16, 2023):

I also seem to have this path showing for a lot of assemblies which I think are the reference assemblies, but are not ignored:
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\

<!-- gh-comment-id:1636976128 --> @CZEMacLeod commented on GitHub (Jul 16, 2023): I also seem to have this path showing for a lot of assemblies which I think are the reference assemblies, but are not ignored: `C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\`
Author
Owner

@brutaldev commented on GitHub (Aug 21, 2023):

@CZEMacLeod Will certainly accept a PR around this if you are willing to make the changes.

There is also the globalPackagesFolder configuration that can be added to a NuGet.config file:

<add key="globalPackagesFolder" value=".\my_packages" />
  • Add NUGET_PACKAGES to processing paths.
  • Try to determine RestorePackagesPath and add to processing and/o probing paths.
  • Add Microsoft.NET.Build.Extensions to the ignore list.
  • Use NuGetPackageFolders properties (if possible) to exclude SDK folders?
<!-- gh-comment-id:1685834723 --> @brutaldev commented on GitHub (Aug 21, 2023): @CZEMacLeod Will certainly accept a PR around this if you are willing to make the changes. There is also the `globalPackagesFolder` configuration that can be added to a NuGet.config file: ``` <add key="globalPackagesFolder" value=".\my_packages" /> ``` - Add `NUGET_PACKAGES` to processing paths. - Try to determine `RestorePackagesPath ` and add to processing and/o probing paths. - Add `Microsoft.NET.Build.Extensions` to the ignore list. - Use `NuGetPackageFolders ` properties (if possible) to exclude SDK folders?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/StrongNameSigner#81
No description provided.