With .NET Core 3.0, a little feature was added to the build process. According to Microsoft:
.NET Core now builds framework-dependent executables by default. This behavior is new for applications that use a globally installed version of .NET Core.
I have searched, but I cannot find a way to prevent this. Unfortunately, this executable causes me issues when pushing my application to Cloud Foundry because it now thinks it's a stand-alone EXE file when it should run it with dotnet cli using the DLL file built for my application.
Is there a way to prevent this default EXE from being built?
I can always add a final step to my build process to remove it, but it seems like there should be a way to prevent it in the first place.
Publishing your app as self-contained produces a platform-specific executable. The output publishing folder contains all components of the app, including the . NET libraries and target runtime. The app is isolated from other . NET apps and doesn't use a locally installed shared runtime.
Self-Contained deployment is a new deployment option that was added in . NET Core. In this mode, you compile platform specific code that is ready to run standalone in a specific target environment.
@PeterHuene and @vcsjones answered the question perfectly in their comments above:
The
UseAppHost
property can be set to false (e.g./p:UseAppHost=false
on the command line) and that will disable the creation of the executable.
or
As an alternative to a command line change, you can also set
<UseAppHost>false</UseAppHost>
in the .csproj's<PropertyGroup>
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With