-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: main
Are you sure you want to change the base?
Conversation
src/Cli/Microsoft.TemplateEngine.Cli/TemplatePackageCoordinator.cs
Outdated
Show resolved
Hide resolved
@@ -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> |
There was a problem hiding this comment.
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 : |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
…into warn-colon-separator
Progress on #45422
Then we can error or remove it in .net 11.
See #45545 for part 1.