Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging .NET Standard assemblies

I couldn't find any documentation on the possibility to merge two (or more) .NET Standard assemblies, either using ILRepack or ILMerge. Both of the tools are merging assemblies of the .NET profiles 2.0, 3.5 and 4.0, but I believe they're not compatible with .NET standard profile.

Has anyone any experience with that? Anyone can point to any documentation of the feature?

Thanks!

like image 849
Antonello Avatar asked Apr 02 '17 07:04

Antonello


People also ask

How do I combine dll files?

A lib file for a dll has no executable code. Yes, it is impossible to merge dll files; there is no tool to do it and it cannot be done manually either.

Where does .NET look for assemblies?

The runtime always begins probing in the application's base, which can be either a URL or the application's root directory on a computer. If the referenced assembly is not found in the application base and no culture information is provided, the runtime searches any subdirectories with the assembly name.

What is assembly and DLL in C#?

An assembly is a collection of one or more files and one of them DLL or EXE. DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries. A DLL file can have a nearly infinite possible entry points.


1 Answers

Not sure if you are still interested but I was able to get this to work with ILRepack a while back.

The main trick was adding a path for NETStandard.Library to RepackOptions.SearchDirectories. Can be as simple as pointing at your nuget dir. Something like: \.nuget\packages\NETStandard.Library\2.0.0\build\netstandard2.0\ref

Otherwise, would get exceptions like "Failed to resolve assembly: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'"

like image 71
Michael Goin Avatar answered Nov 04 '22 00:11

Michael Goin