dotnet / dotnet/sdk

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

Open
#43,701 3 comments 1 reaction 1 assignee Claimed by @dsplaisted View on GitHub
Area-NetSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

## 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](https://github.com/user-attachments/assets/eae12a12-362e-447b-87dc-86e80fd7c777)

## 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](https://github.com/user-attachments/assets/e370b823-9557-407c-919b-004ff722af46)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.