dotnet / dotnet/sdk

apphost file naming may collide with resource directory on Unix systems

Open
#49,731 2 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Area-NetSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

Projects whose assembly name is the same as culture name (`cs`, `de`, `es`, `fr`, `it`, `ja`, `ko`, `pl`, `pt-BR`, `ru`, `tr`, `zh-Hans`, `zh-Hant`) fail to build on Unix system with error

```
sdk/10.0.100-ci/Microsoft.Common.CurrentVersion.targets(5381,5):
error MSB3024: Could not copy the file "cs/obj/Debug/net10.0/apphost"
to the destination file "bin/Debug/net10.0/cs", because the destination is a folder instead of a file.
To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles.
```

This is because the apphost file is named as `$(AssemblyName)$(_NativeExecutableExtension)` and `$(_NativeExecutableExtension)` is empty:

https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L1003

Repro:
```
dotnet new console -o cs
cd cs
dotnet add package Microsoft.CodeAnalysis.CSharp
dotnet build
```

(adding package that deploys resource files)

This is a low pri corner case but it'd be nice to report a better error.

Might be somewhat more interesting for project-less apps (`dotnet run it.cs`).

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.