Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not automatically add nuget.org as a package source when it is absent from nuget.config Fixes #44312 #45410

Open
wants to merge 3 commits into
base: release/9.0.2xx
Choose a base branch
from

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Dec 11, 2024

Fixes #44312

If a user doesn't have nuget.org as a source in their nuget.config, we shouldn't assume they want it. This sends a message for dotnet tool search if nuget.org is absent, as it is needed for dotnet tool search to work properly, instead of running the command. For other commands like dotnet new details, it does not automatically add nuget.org to the sources.

image

image

(Neither command implicitly went to nuget.org.)

Comment on lines 199 to 202
<data name="NeedNuGetInConfig" xml:space="preserve">
<value>The 'dotnet tool search' command unconditionally accesses nuget.org to find tools, but it is not present in your nuget.config. Add it to run this command.</value>
<comment>Do not translate 'dotnet tool search' or 'nuget.config'</comment>
</data>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be providing the command for them to add it? I always find it strange to give the user a message to tell them to do something, but not telling them how to do it. Maybe @baronfel has a suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trick is to make sure that we remember to update the message in case the command needed to run ever changes, otherwise we'd be giving incorrect instructions which is just as bad

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be great if we could just have a command express itself as a string so you could reference it directly in the message? Then, if the command itself changes, the string would update. 😊 (cough my JSON-based parser could do this natively cough)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, I think this one we could probably do without worrying too much about it changing out from under us, as it's the first example in how to use dotnet nuget add source:
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-add-source#examples

I'll add it provisionally, and if we ultimately decide against it, I can take it out again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Templates untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants