Skip to content

Commit

Permalink
search for package folder nearest assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
danielklecha committed Mar 2, 2024
1 parent 6c367f8 commit 17ccb46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DotnetThirdPartyNotices/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public static string GetPackagePath( string assemblyPath )
// packages\{packageName}\{version}\lib\{targetFramework}\{packageName}.dll
// packages\{packageName}\{version}\runtimes\{runtime-identifier}\lib\{targetFramework}\{packageName}.dll
// packages\{packageName}\{version}\lib\{targetFramework}\{culture}\{packageName}.dll
var index = Array.FindIndex(directoryParts, x => NewNugetVersionRegex().IsMatch(x));
var index = Array.FindLastIndex( directoryParts, x => NewNugetVersionRegex().IsMatch(x));
if (index > -1)
return string.Join('\\', directoryParts.Take(index + 1) );
// packages\{packageName}.{version}\lib\{targetFramework}\{packageName}.dll
index = Array.FindIndex(directoryParts, x => OldNugetVersionRegex().IsMatch(x));
index = Array.FindLastIndex(directoryParts, x => OldNugetVersionRegex().IsMatch(x));
if (index > -1)
return string.Join('\\', directoryParts.Take(index + 1));
return null;
Expand Down

0 comments on commit 17ccb46

Please sign in to comment.