question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet build does not include Norwegian resource files in the output

See original GitHub issue

Describe the bug

Building a .sln og .csproj file with dotnet build does not behave as expected for Norwegian resource files.

This seems to work ok with msbuild (if you trigger the build through VS and not directly with dotnet cmdline)

To Reproduce

  1. Create an ASP.NET Core Web App in Visual Studio 2022
  2. Add a folder named Resources
  3. Add resource files for en, de and no with a single resource of key-value "Hello": "World"
  4. Build the solution or project with dotnet build
  5. Navigate to the bin folder and see that only en and de folders are created, there is no no folder
  6. Change name of no to nb and rebuild.
  7. Verify nb folder now exists

screenshot

Further technical details

  • Running on Visual Studio 2022
  • .NET SDK: Version: 6.0.101

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
tarekghcommented, Feb 10, 2022

why can the system resolve “no” to a valid CultureInfo instance with correct data, but not include “no” in the list of cultures returned by CultureInfo.GetCultures(CultureTypes.AllCultures)

There are many aliased cultures. aliased cultures have different names but share the culture data for other standard cultures. Enumeration using CultureInfo.GetCultures doesn’t return the aliased cultures. There are many reasons for that, one is having users use the standard names instead of the aliased ones. The second reason is listing 2 cultures in the enumerations which point to same data can cause issues (e.g. someone populating the list in a dropdown UI list using the display names which can show a duplicate at that time).

MSBuild has a tracking issue https://github.com/dotnet/msbuild/issues/3897 to fix the build as it is not right to scope the support to the cultures returned only by CultureInfo.GetCultures.

Last, I want to emphasize, anyone using CultureInfo.GetCultures to check if any culture is supported or limit the functionality support to such list would be wrong and need to fix that. Now on Windows 10 and any Linux/MacOS when using ICU library, can create any culture with any name conforming to the BCP-47 spec even the system not having a data for that culture. That means it is impossible to return any list satisfying what you want to do. Therefore, we have exposed the API to create the culture and having a Boolean flag to pass if you want to restrict the creations to the cultures has a data in the system.

CC @BenVillalobos

1reaction
DamianEdwardscommented, Feb 10, 2022

Confirmed I can reproduce this. Here’s the relevant part of the binlog: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet build not including text file resource content
These files are accessed in the code as follows: _listItems = Properties.Resources.ListItems.Split(new string[] { Environment.NewLine }, ...
Read more >
dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies. ... from NuGet are typically NOT copied to the output folder....
Read more >
dotnet publish command - .NET CLI
The --output option is disallowed because all outputs of all built projects would be copied into the specified directory, which isn't compatible ...
Read more >
Energy Research Abstracts
File Number DE85770236 . ... 54 collectors with a total area of 1728 m2 are to supply a petro ... Sponsored in part...
Read more >
How To Use Localization in ASP.NET Core
Syntax: file-name.language-region.resx. Next, we are going to add the resource files for localization in our project by following the steps ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found