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

Conflict between "pt-BR" and "pt-br" folders when publishing an ASP.NET application in Docker on Linux #43701

Open
JuanDouglas opened this issue Sep 26, 2024 · 2 comments
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@JuanDouglas
Copy link

JuanDouglas commented Sep 26, 2024

Description

When publishing an ASP.NET application in a Docker environment on Linux, there is a conflict between the pt-BR and pt-br folders. Dotnet automatically generates a folder named pt-br (lowercase), which is used by ASP.NET to locate language-specific libraries. However, when trying to copy the libraries during the publish process, dotnet assumes that the pt-BR (uppercase) folder has already been created, resulting in an error since Linux distinguishes between uppercase and lowercase in directory names.

This issue prevents the libraries from being copied to the correct folder, causing the publish process to fail.

Steps to reproduce:

  1. Create an ASP.NET Core project with a localized resource (Resources.pt-BR.resx).
  2. Include the NuGet package that contains resource files for the pt-BR folder.
  3. Publish the project in a Docker Linux environment.
  4. Observe the error during the library copy process to the pt-BR folder.

Expected behavior:

Dotnet should correctly differentiate between the pt-BR and pt-br folders in the Linux environment, creating or using the correct folder as expected by ASP.NET, without confusing the two directories.

Actual behavior:

Dotnet detects that the pt-br folder was created and assumes that the pt-BR folder already exists. However, since Linux differentiates between uppercase and lowercase in directory names, the pt-BR folder was not created, causing an error when trying to copy the files to that directory.

Error message:

The error message indicates that part of the copy directory has not been created yet, which is why the file copy operation was not completed.

/usr/share/dotnet/sdk/8.0.402/Sdks /Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(351,5): error MSB3021: Unable to copy file "/root/.nuget/packages/packagename/1.0.6.1/lib/net8.0/pt-BR/packagename.resources.dll" to "/app/publish/pt-BR/packagename.resources.dll". Could not find a part of the path '/app/publish/pt-BR/packagename.resources.dll'. [/app/project/project/project.csproj]

docker-error

Environment:

Operating System: Linux (Docker container mcr.microsoft.com/dotnet/sdk:8.0)
Framework: .NET 8.0
ASP.NET Core 8.0
Docker version: 20.x.x

Possible solution:

A possible solution would be to adjust the publish process so that dotnet correctly creates or checks for the existence of resource folders, taking into account the case sensitivity of directory names on Linux file systems.

Current workaround:

As a temporary solution, the pt-BR folder can be manually created before publishing. However, this is not ideal for automated CI/CD pipelines.
solução

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Sep 26, 2024
@KalleOlaviNiemitalo
Copy link

In your current workaround, you create the pt-BR folder; but does the runtime then load the resource DLL from that folder or does it look in the pt-br folder only?

@JuanDouglas
Copy link
Author

@KalleOlaviNiemitalo, sorry, the error does not occur at runtime but rather at publish time. Unfortunately, I have not been able to test the project in question within the environment to confirm, but I believe the reference is being loaded.

What makes it a bit strange is that no error occurs during the build (I was able to test the reference in the build, and it is working as it should).

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

No branches or pull requests

2 participants