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

Warn on :: use in dotnet new install towards #45422 #45552

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Dec 18, 2024

Progress on #45422

Then we can error or remove it in .net 11.

@Forgind Forgind requested a review from a team as a code owner December 18, 2024 22:05
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Request triage from a team member labels Dec 18, 2024
@@ -531,6 +531,9 @@ Run 'dotnet {1} --show-aliases' with no args to show all aliases.</value>
<data name="TemplatePackageCoordinator_Install_Error_FoundNoPackagesToInstall" xml:space="preserve">
<value>Found no template packages to install.</value>
</data>
<data name="Colon_Separator_Deprecated" xml:space="preserve">
<value>The colon separator "::" has been deprecated in favor of the at symbol "@" for separating the package from the version in dotnet new install. In your case, this means {0}@{1} instead of {0}::{1}.</value>
Copy link
Member

Choose a reason for hiding this comment

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

I think it is more commonly referred to as the at sign. Idk why it is done that way, but best stick with conventions most people would easily recognize. Also, I think dotnet new install should be wrapped in single quotes and I believe there is a way in the resx to let the translators know that dotnet new install should not be translated.

string[] splitByAt = installArg.Split('@', StringSplitOptions.RemoveEmptyEntries);
string[] split = splitByColons.Length > splitByAt.Length ? splitByColons :
splitByAt.Length > splitByColons.Length ? splitByAt :
splitByColons[0].Length < splitByAt[0].Length ? splitByColons :
Copy link
Member

Choose a reason for hiding this comment

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

What scenario is this condition for?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was supposed to be to handle cases in which the separator is ::, the separator is @, and there isn't a real separator; it just ends in one of those. I don't think that last case is common, but it appeared in a test, so I made it complicated for that reason.

I think I should change it to this, though:
string[] split = installArg.Split("::", StringSplitOptions.RemoveEmptyEntries).SelectMany(arg => arg.Split('@', StringSplitOptions.RemoveEmptyEntries)).ToArray();

Seems simpler, and it should be robust to another edge case that I don't think is super important:
dotnet new install package1::version1 package2@version2

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

Successfully merging this pull request may close these issues.

2 participants