Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the executable name on publish in .NET 7

to demonstrate i will use illustrative names.

  • I use VSCode

The problem

I have a project with name App.

I i enter on my terminal and type: dotnet publish --configuration Release -o build

i will have an exe ./build/App.exe.

this is the current behavior.

The wanted solution

So, i need the executable name to be cli.exe when i run the publish command instead of App.exe.

How can i do that?

I have been tried the:

<TargetName>cli</TargetName>

but this tag only changes the .dll file, not the .exe.

like image 669
Marcos Venicius Avatar asked Oct 28 '25 19:10

Marcos Venicius


1 Answers

Instead of TargetName use AssemblyName

like image 148
Magnetron Avatar answered Oct 31 '25 08:10

Magnetron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!