Thanks for reaching out! Here are the clarifications for the questions
- Microsoft-supported way to merge class libraries into one DLL
No.
.NET Core / .NET 6+ intentionally does not support assembly merging for class libraries.
ILMerge / ILRepack are not supported for modern .NET and are unreliable.
Microsoft has explicitly moved away from this model.
2.Are ILMerge / ILRepack / Costura recommended?
No, for production grade modern .NET.
Works by embedding dependencies as resources, not officially supported by Microsoft
3.Why PublishSingleFile doesn’t apply here
PublishSingleFile is ONLY for executable apps, it does NOT work for:
Class libraries, NuGet packages
This is by design and will not change
Here are some correct way
- NuGet package with dependency references
- Package your class library as a NuGet package
- Declare dependencies normally
- NuGet handles versioning, resolution, and compatibility