Skip to content

apphost file naming may collide with resource directory on Unix systems #49731

Open
@tmat

Description

@tmat

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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions