ALL of my .net core dockerfiles are 99% the same except for this last line:
ENTRYPOINT ["dotnet", "<APP NAME HERE>.dll"]
seems pretty dumb of me because they could all be identical otherwise
Is there a way to change the dll name with the dotnet publish -c Release -o out command? can I do that without having to modify csproj files or anything?
You can use this command to perform the build and rename the assembly:
On Linux/macOS you will have to add quotes around the command, like this:
However, there can be unintended side effects due to a global property being set. You should read this open issue from Sep 2019 as it speaks directly to your question regarding Docker and renaming the output: https://github.com/dotnet/msbuild/issues/4696
Also, I know you wanted to avoid editing the .csproj file, but in case you aren't aware, you can add the
AssemblyNameproperty and set the output name in that manner.Such as:
This will create
foo.dll(and other files as well, e.g..pdb,.deps.json, etc.)