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

Installing three-letter ISO localized packages are not compatible. #10805

Closed
JonDouglas opened this issue Apr 27, 2021 · 8 comments
Closed

Installing three-letter ISO localized packages are not compatible. #10805

JonDouglas opened this issue Apr 27, 2021 · 8 comments
Labels
Functionality:Install The install command in VS/nuget.exe Functionality:Locals Resolution:Duplicate This issue appears to be a Duplicate of another issue Triage:Investigate

Comments

@JonDouglas
Copy link
Contributor

Details about Problem

When installing any package that has been localized with resource assemblies & contains a three-letter ISO name, it will fail to install.

https://docs.microsoft.com/en-us/nuget/create-packages/creating-localized-packages

NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe):

16.9, dotnet SDK 5.0.202

Worked before? If so, with which NuGet version:

N/A, but does work with 2 letter locale packages such as zh-CN (i.e. https://www.nuget.org/packages/Humanizer.Core.zh-CN/2.9.7)

Repro steps and/or sample project

  1. Create a .NET 5 console application
  2. Install https://www.nuget.org/packages/Humanizer.Core.fil-PH/2.9.7
  3. Error
Running restore with 8 concurrent jobs.
Reading project file C:\Users\Jon-Personal\source\repos\ConsoleApp12\ConsoleApp12\ConsoleApp12.csproj.
Restoring packages for C:\Users\Jon-Personal\source\repos\ConsoleApp12\ConsoleApp12\ConsoleApp12.csproj...
Restoring packages for .NETCoreApp,Version=v5.0...
Resolving conflicts for net5.0...
Checking compatibility of packages on net5.0.
Checking compatibility for ConsoleApp12 1.0.0 with net5.0.
Checking compatibility for Newtonsoft.Json 13.0.1 with net5.0.
Checking compatibility for System.Linq.Dynamic 1.0.8 with net5.0.
Checking compatibility for Humanizer.Core.fil-PH 2.9.7 with net5.0.
Checking compatibility for Humanizer.Core 2.9.7 with net5.0.
Incompatible packages: 1
NU1701: Package 'System.Linq.Dynamic 1.0.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
NU1202: Package Humanizer.Core.fil-PH 2.9.7 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package Humanizer.Core.fil-PH 2.9.7 does not support any target frameworks.
Package restore failed. Rolling back package changes for 'ConsoleApp12'.
Time Elapsed: 00:00:00.0547089
========== Finished ==========
  1. Create a dotnet new .NET 5 console application
  2. Install https://www.nuget.org/packages/Humanizer.Core.fil-PH/2.9.7
  3. Error:
dotnet add package Humanizer.Core.fil-PH
  Determining projects to restore...
  Writing C:\Users\Jon-Personal\AppData\Local\Temp\tmpF27F.tmp
info : Adding PackageReference for package 'Humanizer.Core.fil-PH' into project 'C:\Users\Jon-Personal\source\repos\ConsoleApp12\ConsoleApp12\ConsoleApp12.csproj'.
info :   CACHE https://api.nuget.org/v3/registration5-gz-semver2/humanizer.core.fil-ph/index.json
info : Restoring packages for C:\Users\Jon-Personal\source\repos\ConsoleApp12\ConsoleApp12\ConsoleApp12.csproj...
warn : NU1701: Package 'System.Linq.Dynamic 1.0.8' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
error: NU1202: Package Humanizer.Core.fil-PH 2.9.7 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package Humanizer.Core.fil-PH 2.9.7 does not support any target frameworks.
error: Package 'Humanizer.Core.fil-PH' is incompatible with 'all' frameworks in project 'C:\Users\Jon-Personal\source\repos\ConsoleApp12\ConsoleApp12\ConsoleApp12.csproj'.

Investigation

https://docs.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo?view=net-5.0#culture-names-and-identifiers has some interesting cases around availability of two-letter vs. three-letter.

https://stackoverflow.com/a/21042311/1048571 seems to suggest that CultureInfo limitations too. The list https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes doesn’t include fil in it. However 639-2 & 639-3 do include it.

The format for the culture name based on RFC 4646 is languagecode2>-country/regioncode2, where languagecode2 is the two-letter language code and country/regioncode2 is the two-letter subculture code. Examples include ja-JP for Japanese (Japan) and en-US for English (United States). In cases where a two-letter language code is not available, a three-letter code derived from ISO 639-2 is used.

InvariantCulture should handle this however? I’m not aware of any specific code in NuGet that limits as this fails in both VS & dotnet CLI which have different compat code for installing.

@kartheekp-ms kartheekp-ms added Functionality:Install The install command in VS/nuget.exe Functionality:Locals labels Apr 27, 2021
@nkolev92
Copy link
Member

I think there's a dup in #2245.

@kartheekp-ms can you please verify.

@nkolev92
Copy link
Member

Triage: @jebriede can you please take a look.

@heng-liu heng-liu added this to the Sprint 2021-06 milestone Jun 7, 2021
@zkat zkat assigned zkat and unassigned heng-liu Jun 7, 2021
@aortiz-msft
Copy link
Contributor

@v-luzh - does this work on NuGet 5.8 or earlier?

@aortiz-msft aortiz-msft assigned v-luzh and unassigned zkat Jun 10, 2021
@v-luzh
Copy link

v-luzh commented Jun 17, 2021

@aortiz-msft it repro on VS D16.8\30420.98 with implicit NuGet 5.8.0.6776 as below screenshot, but the difference is it didn't show error NU1701.
image

@v-luzh v-luzh assigned aortiz-msft and unassigned v-luzh Jun 17, 2021
@aortiz-msft aortiz-msft removed their assignment Jun 18, 2021
@nkolev92
Copy link
Member

Closing as dup of #2245

@nkolev92 nkolev92 added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Jun 21, 2021
@clairernovotny
Copy link

Why was this closed as a dup? Seems like a different issue with three letter locales? This is preventing certain locales from working:

Humanizr/Humanizer#1057

@MarkIvanDev
Copy link

This is still a problem today. I hope there is a fix to support three-letter locales.

@ChandraTang
Copy link

@JonDouglas can this be re-opened? This still a problem after three years. @nkolev92 had pointed out the issue in another issue (I missed the link) is here
https://github.com/NuGet/NuGet.Client/blob/84d99ce064a5f70628c89af9f30693581e84dc37/src/NuGet.Core/NuGet.Packaging/ContentModel/ManagedCodeConventions.cs#L143-L164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Install The install command in VS/nuget.exe Functionality:Locals Resolution:Duplicate This issue appears to be a Duplicate of another issue Triage:Investigate
Projects
None yet
Development

No branches or pull requests

10 participants