.NET Core and .NET 5 have the single file executable feature.
How can I exclude a managed assembly from being packed into that single file?
Example: I might want that app.exe
includes MyLib.A.dll
and MyLib.B.dll
, but not MyLib.Special.dll
. Instead, I might want that MyLib.Special.dll
resides on disk next to app.exe
and is loaded from there.
(Background: It could be that MyLib.Special.dll
is licensed under the L-GPL, but app.exe
is proprietary.)
You can use ExcludeFromSingleFile inside of a ProjectReference element to prevent the assembly from being embedded, like so: