9

How do I create framework-dependent executables (FDE) with .NET Core 2.2? The MSDN documentation mentions them here as a new feature for .NET Core 2.2:

Framework-dependent executables (FDE)

Starting with .NET Core 2.2, you can deploy your app as an FDE, along with any required third-party dependencies. Your app will use the version of .NET Core that's installed on the target system.

Sadly the step-by-step examples still only refer to self-contained and framework-dependent deployments (FDD).

Voo
  • 26,852
  • 9
  • 70
  • 145
  • You might want to vote here: https://github.com/dotnet/docs/issues/9728. – Patrick Hofman Jan 07 '19 at 13:48
  • @Patrick Will certainly do that, although I'd love to get an answer a bit quicker than it takes to get that issue resolved :-) You don't happen to have a link to the github issue that implemented FDEs? Can't find it, but I assume I could figure out how to do what I want from there. – Voo Jan 07 '19 at 13:50
  • And more stuff to read [here](https://blogs.msdn.microsoft.com/dotnet/2018/12/04/announcing-net-core-3-preview-1-and-open-sourcing-windows-desktop-frameworks/) on .NET Core 3, where "Applications now have executables by default". – Patrick Hofman Jan 07 '19 at 13:50
  • No, unfortunately I have to revert to using Google here. – Patrick Hofman Jan 07 '19 at 13:51
  • @Patrick Afraid that the .NET Core 3 stuff is really just for 3.0. Building it with 2.2 doesn't result in a exe but still only a dll without dependencies. But yes also googling to see if I can find something - will answer my question if I can figure it out (or get ahold of someone who knows) – Voo Jan 07 '19 at 13:54
  • I know, but it might be worth reading up on that since it might fix your issue in the future, or provide with some pointers how to go forward. – Patrick Hofman Jan 07 '19 at 13:54

1 Answers1

11

.NET Core 2.2

The way to do this is to specify a runtime identifier and then --self-contained false:

dotnet publish -c Release -r win-x64 --self-contained false

This will generate an executable without including the whole .NET Core framework.

.NET Core 3.0

For .NET Core 3.0 the following can be used:

dotnet publish -c Release -r win-x64 --no-self-contained
Voo
  • 26,852
  • 9
  • 70
  • 145
  • *Note:* This question is for .NET Core 2.2 but the new way with .NET Core 3.0 is to use the `--no-self-contained` flag instead of `--self-contained false` – Jérôme MEVEL Nov 12 '19 at 15:07
  • @Jérôme Fair enough to keep this up to date. I don't have a dotnet core 3.0 project in front of me right now, but I'd assume the edit should work correctly? – Voo Nov 12 '19 at 16:33
  • 1
    I tested with .NET Core 3.0, actually both ways work. Yes your edit is correct – Jérôme MEVEL Nov 12 '19 at 16:42