Skip to content

Handle empty paths when locating extensions#7145

Merged
kartheekp-ms merged 1 commit intoNuGet:devfrom
viceice:viceice-patch-1
Feb 19, 2026
Merged

Handle empty paths when locating extensions#7145
kartheekp-ms merged 1 commit intoNuGet:devfrom
viceice:viceice-patch-1

Conversation

@viceice
Copy link
Copy Markdown
Contributor

@viceice viceice commented Feb 16, 2026

Bug

Description

Assembly.Location can return inly the assembly name and then the result is an empty path string.
This especially happens when you try to bundle with mono (mkbundle).

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

Signed-off-by: Michael Kriese <michael.kriese@gmx.de>
@viceice viceice requested a review from a team as a code owner February 16, 2026 13:55
@dotnet-policy-service dotnet-policy-service bot added the Community PRs created by someone not in the NuGet team label Feb 16, 2026
@viceice

This comment was marked as resolved.

@dcasota
Copy link
Copy Markdown

dcasota commented Feb 16, 2026

@viceice nice find! the PR’s one-line change is perfectly fine for a stable, low-risk backport.

@viceice
Copy link
Copy Markdown
Contributor Author

viceice commented Feb 16, 2026

@viceice nice find! the PR’s one-line change is perfectly fine for a stable, low-risk backport.

thanks. is there anything i can / should do?

@kartheekp-ms
Copy link
Copy Markdown
Contributor

kartheekp-ms commented Feb 18, 2026

@viceice thanks for the fix. The proposed changes look good to me.

A couple of follow-ups before we merge:

  1. Tracking issue - Could you please file an issue in https://github.com/NuGet/Home (and link it here)? We track customer-facing fixes there so it can be included in the next NuGet release notes.

  2. Testing - Please share how you tested the change.

https://github.com/NuGet/NuGet.Client/blob/dev/CONTRIBUTING.md#build has all the required information to build the nuget.exe locally with this change for manual validation.

@viceice
Copy link
Copy Markdown
Contributor Author

viceice commented Feb 18, 2026

@kartheekp-ms

  1. nuget cli should handle empty paths when locating extensions Home#14764

  2. tested locally with windows and wsl

$ .\artifacts\VS15\NuGet.exe help
NuGet Version: 7.5.0.65534
usage: NuGet <command> [args] [options]
Type 'NuGet help <command>' for help on a specific command.

Available commands:

 add               Adds the given package to a hierarchical source. http sources are not supported. For more info, goto https://docs.nuget.org/consume/command-line-reference#add-command.

 client-certs      Provides the ability to manage list of client certificates located in NuGet.config files

 config            Gets or sets NuGet config values.

 delete            Deletes a package from the server.

 eula              Display NuGet.exe's End User Liscence Agreement (EULA)

 help (?)          Displays general help information and help information about other commands.

 init              Adds all the packages from the <srcPackageSourcePath> to the hierarchical <destPackageSourcePath>. http feeds are not supported. For more info, goto https://docs.nuget.org/consume/command-line-reference#init-command.

 install           Installs a package using the specified sources. If no sources are specified, all sources defined in the NuGet configuration file are used. If the configuration file specifies no sources, uses the default NuGet feed.

 list              Displays a list of packages from a given source. If no sources are specified, all sources defined in %AppData%\NuGet\NuGet.config are used. If NuGet.config specifies no sources, uses the default NuGet feed.

 locals            Clears or lists local NuGet resources such as http requests cache, temp cache or machine-wide global packages folder.

 pack              Creates a NuGet package based on the specified nuspec or project file.

 push              Pushes a package to the server and publishes it.
                   NuGet's default configuration is obtained by loading %AppData%\NuGet\NuGet.config, then loading any nuget.config or .nuget\nuget.config starting from root of drive and ending in current directory.

 restore           Restores NuGet packages.

 search            Searches a given source using the query string provided. If no sources are specified, all sources defined in %AppData%\NuGet\NuGet.config are used.

 setApiKey         Saves an API key for a given server URL. When no URL is provided API key is saved for the NuGet gallery.

 sign              Signs a NuGet package with the specified certificate.

 sources           Provides the ability to manage list of sources located in NuGet.config files.

 spec              Generates a nuspec for a new package. If this command is run in the same folder as a project file (.csproj, .vbproj, .fsproj), it will create a tokenized nuspec file.

 trusted-signers   Provides the ability to manage the list of trusted signers.

 update            Update packages to latest available versions. This command also updates NuGet.exe itself.

 verify            Verifies a signed NuGet package.

For more information, visit https://docs.nuget.org/docs/reference/command-line-reference
$ mkbundle -o nuget --simple artifacts/VS15/NuGet.exe --machine-config /etc/mono/4.5/machine.config  --config /etc/mono/config -L /lib/mono/4.5/Facades/
Using runtime: /usr/bin/mono
     Assembly: /mnt/c/Users/kriese/projects/gh/viceice/nuget-NuGet.Client/artifacts/VS15/NuGet.exe
       Config: /mnt/c/Users/kriese/projects/gh/viceice/nuget-NuGet.Client/artifacts/VS15/NuGet.exe.config
     Assembly: /usr/lib/mono/4.5/mscorlib.dll
     Assembly: /usr/lib/mono/4.5/System.Core.dll
     Assembly: /usr/lib/mono/4.5/System.dll
     Assembly: /usr/lib/mono/4.5/System.Configuration.dll
     Assembly: /usr/lib/mono/4.5/System.Xml.dll
     Assembly: /usr/lib/mono/4.5/System.Security.dll
     Assembly: /usr/lib/mono/4.5/System.Numerics.dll
     Assembly: /usr/lib/mono/4.5/Mono.Security.dll
     Assembly: /usr/lib/mono/4.5/System.Xml.Linq.dll
     Assembly: /usr/lib/mono/4.5/System.ComponentModel.Composition.dll
     Assembly: /usr/lib/mono/4.5/Microsoft.CSharp.dll
     Assembly: /usr/lib/mono/4.5/System.Net.Http.dll
     Assembly: /lib/mono/4.5/Facades/netstandard.dll
     Assembly: /usr/lib/mono/4.5/System.Data.dll
     Assembly: /usr/lib/mono/4.5/System.Transactions.dll
     Assembly: /usr/lib/mono/4.5/System.EnterpriseServices.dll
     Assembly: /usr/lib/mono/4.5/System.Data.DataSetExtensions.dll
     Assembly: /usr/lib/mono/4.5/System.Drawing.dll
     Assembly: /usr/lib/mono/4.5/System.IO.Compression.dll
     Assembly: /usr/lib/mono/4.5/System.IO.Compression.FileSystem.dll
     Assembly: /usr/lib/mono/4.5/System.Runtime.Serialization.dll
     Assembly: /usr/lib/mono/4.5/System.ServiceModel.Internals.dll
     Assembly: /usr/lib/mono/4.5/System.Web.dll
     Assembly: /usr/lib/mono/4.5/System.Web.ApplicationServices.dll
     Assembly: /usr/lib/mono/4.5/System.Runtime.Serialization.Formatters.Soap.dll
     Assembly: /usr/lib/mono/4.5/System.Web.Services.dll
     Assembly: /usr/lib/mono/4.5/System.Design.dll
     Assembly: /usr/lib/mono/4.5/System.Windows.Forms.dll
     Assembly: /usr/lib/mono/4.5/Mono.WebBrowser.dll
     Assembly: /usr/lib/mono/4.5/Mono.Posix.dll
     Assembly: /usr/lib/mono/4.5/Accessibility.dll
     Assembly: /usr/lib/mono/4.5/System.DirectoryServices.dll
     Assembly: /usr/lib/mono/4.5/Novell.Directory.Ldap.dll
     Assembly: /usr/lib/mono/4.5/Mono.Data.Sqlite.dll
     Assembly: /usr/lib/mono/4.5/System.ComponentModel.DataAnnotations.dll
     Assembly: /usr/lib/mono/4.5/Microsoft.Build.Utilities.v4.0.dll
     Assembly: /usr/lib/mono/4.5/Microsoft.Build.Framework.dll
     Assembly: /usr/lib/mono/4.5/System.ServiceModel.dll
     Assembly: /usr/lib/mono/4.5/System.IdentityModel.dll
     Assembly: /usr/lib/mono/4.5/System.Messaging.dll
     Assembly: /usr/lib/mono/4.5/Mono.Messaging.dll
     Assembly: /usr/lib/mono/4.5/System.Configuration.Install.dll
     Assembly: /usr/lib/mono/4.5/System.ServiceModel.Activation.dll
     Assembly: /usr/lib/mono/4.5/System.IdentityModel.Selectors.dll
     Assembly: /usr/lib/mono/4.5/WindowsBase.dll
     Assembly: /usr/lib/mono/4.5/System.Xaml.dll
     Assembly: /usr/lib/mono/4.5/System.Data.Services.Client.dll
     Assembly: /usr/lib/mono/4.5/I18N.West.dll
     Assembly: /usr/lib/mono/4.5/I18N.dll
systemconfig: /etc/mono/config
machineconfig: /etc/mono/4.5/machine.config
Generated nuget
$ ./nuget help
NuGet.exe
$ ./nuget search nuget.commandline -Take 1
====================
Source: dotnet-eng
--------------------
No results found.
--------------------

====================
Source: dotnet-public
--------------------
> NuGet.CommandLine | 7.3.0 | Downloads: N/A
  NuGet Command Line Interface.
--------------------

====================
Source: dotnet-libraries
--------------------
No results found.
--------------------

====================
Source: myget-legacy@Local
--------------------
No results found.
--------------------

====================
Source: nuget-build
--------------------
No results found.
--------------------

====================
Source: vside
--------------------
No results found.
--------------------
$ mono artifacts/VS15/NuGet.exe help
NuGet Version: 7.5.0.65534
usage: NuGet <command> [args] [options]
Type 'NuGet help <command>' for help on a specific command.

Available commands:

 add               Adds the given package to a hierarchical source. http sources are not supported. For more info, goto https://docs.nuget.org/consume/command-line-reference#add-command.

 client-certs      Provides the ability to manage list of client certificates located in NuGet.config files

 config            Gets or sets NuGet config values.

 delete            Deletes a package from the server.

 eula              Display NuGet.exe's End User Liscence Agreement (EULA)

 help (?)          Displays general help information and help information about other commands.

 init              Adds all the packages from the <srcPackageSourcePath> to the hierarchical <destPackageSourcePath>. http feeds are not supported. For more info, goto https://docs.nuget.org/consume/command-line-reference#init-command.

 install           Installs a package using the specified sources. If no sources are specified, all sources defined in the NuGet configuration file are used. If the configuration file specifies no sources, uses the default NuGet feed.

 list              Displays a list of packages from a given source. If no sources are specified, all sources defined in %AppData%\NuGet\NuGet.config are used. If NuGet.config specifies no sources, uses the default NuGet feed.

 locals            Clears or lists local NuGet resources such as http requests cache, temp cache or machine-wide global packages folder.

 pack              Creates a NuGet package based on the specified nuspec or project file.

 push              Pushes a package to the server and publishes it.
                   NuGet's default configuration is obtained by loading %AppData%\NuGet\NuGet.config, then loading any nuget.config or .nuget\nuget.config starting from root of drive and ending in current directory.

 restore           Restores NuGet packages.

 search            Searches a given source using the query string provided. If no sources are specified, all sources defined in %AppData%\NuGet\NuGet.config are used.

 setApiKey         Saves an API key for a given server URL. When no URL is provided API key is saved for the NuGet gallery.

 sign              Signs a NuGet package with the specified certificate.

 sources           Provides the ability to manage list of sources located in NuGet.config files.

 spec              Generates a nuspec for a new package. If this command is run in the same folder as a project file (.csproj, .vbproj, .fsproj), it will create a tokenized nuspec file.

 trusted-signers   Provides the ability to manage the list of trusted signers.

 update            Update packages to latest available versions. This command also updates NuGet.exe itself.

 verify            Verifies a signed NuGet package.

For more information, visit https://docs.nuget.org/docs/reference/command-line-reference

not sure why it doesn't show the expected help 🤔 maybe more bugs

@kartheekp-ms
Copy link
Copy Markdown
Contributor

kartheekp-ms commented Feb 18, 2026

@viceice thanks for your response.

not sure why it doesn't show the expected help 🤔 maybe more bugs

Does this statement mean that the proposed changes didn't work as expected or there are other bugs that you have noticed unrelated to this change. If there are other bugs, can you please add more information with expected vs actual behavior?

@viceice
Copy link
Copy Markdown
Contributor Author

viceice commented Feb 18, 2026

that seems to be another bug, I'll file it separately when I've analyzed the cause.

so this fix works as intended

@kartheekp-ms kartheekp-ms enabled auto-merge (squash) February 18, 2026 23:22
@kartheekp-ms kartheekp-ms merged commit 73f2208 into NuGet:dev Feb 19, 2026
17 checks passed
@viceice viceice deleted the viceice-patch-1 branch February 19, 2026 06:02
@aortiz-msft aortiz-msft added the Learning Opportunity Triggers an in-depth conversation in the weekly PR review meeting so that reviewers can learn more label Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team Learning Opportunity Triggers an in-depth conversation in the weekly PR review meeting so that reviewers can learn more

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nuget cli should handle empty paths when locating extensions mkbundle nuget.exe on linux

4 participants