-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I'd like to be able to control the published single file name independently from the assembly name. I can't set the assembly name to the desired published single file name because it would conflict with a library assembly name in the same project. However, the published single file name can be set to anything without causing a conflict, as evidenced by testing after renaming it to the desired file name after publishing.
It seems setting <PublishedSingleFileName>Xyz.exe</PublishedSingleFileName>
in the .csproj is very close to working:
sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
Lines 1069 to 1072 in f498215
<PropertyGroup> | |
<PublishedSingleFileName>$(AssemblyName)$(_NativeExecutableExtension)</PublishedSingleFileName> | |
<PublishedSingleFilePath>$(PublishDir)$(PublishedSingleFileName)</PublishedSingleFilePath> | |
</PropertyGroup> |
We just need to change one line to follow the standard MSBuild "provide default if not already set" pattern:
<PropertyGroup>
<PublishedSingleFileName Condition="'$(PublishedSingleFileName)' == ''">$(AssemblyName)$(_NativeExecutableExtension)</PublishedSingleFileName>
<PublishedSingleFilePath>$(PublishDir)$(PublishedSingleFileName)</PublishedSingleFilePath>
</PropertyGroup>
Alternatively, if it would be desirable to use a different csproj property which specifies only the name part without the .exe
file extension, a new property could be introduced or PublishedSingleFileName
could be refactored to not include the .exe
part.
Happy to send a PR.