{"id":13679500,"url":"https://github.com/dotnet/ILMerge","last_synced_at":"2025-04-29T19:31:19.497Z","repository":{"id":37502723,"uuid":"67747274","full_name":"dotnet/ILMerge","owner":"dotnet","description":"ILMerge is a static linker for .NET Assemblies.","archived":true,"fork":false,"pushed_at":"2020-07-09T16:44:18.000Z","size":708,"stargazers_count":1274,"open_issues_count":52,"forks_count":175,"subscribers_count":109,"default_branch":"master","last_synced_at":"2025-04-19T09:29:21.709Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotnet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-08T23:12:32.000Z","updated_at":"2025-04-18T20:08:55.000Z","dependencies_parsed_at":"2022-07-12T15:50:52.155Z","dependency_job_id":null,"html_url":"https://github.com/dotnet/ILMerge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet%2FILMerge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet%2FILMerge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet%2FILMerge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet%2FILMerge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotnet","download_url":"https://codeload.github.com/dotnet/ILMerge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250539585,"owners_count":21447335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:01:06.201Z","updated_at":"2025-04-29T19:31:18.944Z","avatar_url":"https://github.com/dotnet.png","language":"C#","readme":"# ILMerge\n\n[![NuGet](https://img.shields.io/nuget/v/ILMerge.svg?style=flat-square\u0026label=nuget)](https://www.nuget.org/packages/ILMerge/)\n\nILMerge is a utility that merges multiple .NET assemblies into a single assembly.\nIt is freely available for use and is available as a [NuGet package](https://www.nuget.org/packages/ilmerge).\n\nIf you have any problems using it, please get in touch. (mbarnett _at_ microsoft _dot_ com).\nBut first try reading [the documentation](ilmerge-manual.md).\n\nILMerge takes a set of input assemblies and merges them into one target assembly.\nThe first assembly in the list of input assemblies is the primary assembly.\nWhen the primary assembly is an executable,\nthen the target assembly is created as an executable with the same entry point as the primary assembly.\nAlso, if the primary assembly has a strong name, and a .snk file is provided,\nthen the target assembly is re-signed with the specified key so that it also has a strong name.\n\nILMerge is packaged as a console application.\nBut all of its functionality is also available programmatically.\n\nThere are several options that control the behavior of ILMerge.\nSee the documentation that comes with the tool for details.\n\nThe current version is 3.0.29 (released on 10 April 2019).\nNOTE: There is no longer a version of ILMerge that runs in the v1.1 runtime.\n\nILMerge runs in the v4.0 .NET Runtime,\nbut it is also able to merge assemblies from other framework versions using the `/targetplatformoption`.\nPlease see the documentation.\n(However, it can merge PDB files only for v2 (and later) assemblies.)\n\nCurrently, ILMerge works only on Windows-based platforms. It does not yet support Rotor or Mono.\n\nIf you use ASP.NET v2.0, then it provides a tool (based on ILMerge) to combine assemblies created during precompilation.\nYou can get more details from the [ASP.NET web site](http://msdn.microsoft.com/en-us/library/bb397866.aspx).\n\n## Installation\n\nAs noted on the [ilmerge NuGet page](https://www.nuget.org/packages/ilmerge), the package can be installed from the Visual Studio environment. Expand the project container in the `Solution Explorer` view. Right click on `references` and select `Manage NuGet Packages`\n\n![NuGet References Setting](images/NuGet_references_setting.png)\n\nEnsure the `Package source` is set to `nuget.org`\n\n![NuGet Package source](images/NuGet_Package_source.png)\n\nNext, click on Tools - NuGet Package Manager - Package Manager Console. Ensure the `Package source` is also set to `nuget.org` \n\n![NuGet Pakage Manager Console source.PNG](images/NuGet_Package_Manager_Console_source.png)\n\nTo install for the project, use the Install-Package command:\n\n```\nInstall-Package ilmerge -Version 3.0.29\n```\n\n## Usage\n\n### MSBuild\n\nILMerge can be used in MSBuild using the NuGet package:\n\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n\n  \u003cItemGroup\u003e\n    \u003cPackageReference Include=\"ILMerge\" Version=\"3.0.29\" /\u003e\n  \u003c/ItemGroup\u003e\n\n  \u003cTarget Name=\"ILMerge\"\u003e\n    \u003c!-- the ILMergePath property points to the location of ILMerge.exe console application --\u003e\n    \u003cExec Command=\"$(ILMergeConsolePath) /out:Merged.dll File1.dll File2.dll\" /\u003e\n  \u003c/Target\u003e\n\n\u003c/Project\u003e\n```\n\nEdit the project `.csproj` or `.vbproj` files (inside the respective `\u003cProject\u003e .. \u003c/Project\u003e` tags, typically at the end of the file. If compiling for a specific target, use explicit directories such as `Bin\\x64\\Release`:\n\n\n```\n\u003cItemGroup\u003e\n    \u003cPackageReference Include=\"ILMerge\" Version=\"3.0.29\" /\u003e\n  \u003c/ItemGroup\u003e\n\n  \u003cTarget Name=\"ILMerge\"\u003e\n    \u003c!-- the ILMergePath property points to the location of ILMerge.exe console application --\u003e\n    \u003cExec Command=\"$(ILMergeConsolePath) Bin\\x64\\Release\\myapp.exe  /out:myapp.exe Bin\\x64\\Release\\File1.dll Bin\\x64\\Release\\File2.dll Bin\\x64\\Release\\File3.dll \" /\u003e\n  \u003c/Target\u003e\n```\nAlthough whitespace is usually ignored in XML files, in this case the exact text is processed as a DOS command, so to improve readability, use the carat `^` (shift 6) line extenders:\n\n```\n\u003cItemGroup\u003e\n    \u003cPackageReference Include=\"ILMerge\" Version=\"3.0.29\" /\u003e\n  \u003c/ItemGroup\u003e\n\n  \u003cTarget Name=\"ILMerge\"\u003e\n    \u003c!-- the ILMergePath property points to the location of ILMerge.exe console application --\u003e\n    \u003cExec Command=\"$(ILMergeConsolePath) Bin\\x64\\Release\\myapp.exe ^\n    /out:myapp.exe ^\n    Bin\\x64\\Release\\File1.dll ^\n    Bin\\x64\\Release\\File2.dll ^ \n    Bin\\x64\\Release\\File3.dll \" /\u003e\n  \u003c/Target\u003e\n```\n\nThe DOS dir /b option can be helpful in listing all of the dependencies:\n```\ndir bin\\x64\\Debug\\*.dll /b\n```\n\nFrom Visual Studio Developer Command Prompt:\n```ps1\n# Download/install the package reference\nmsbuild /t:Restore\n\n# Run the ILMerge target\nmsbuild /t:ILMerge\n```\n\n### To run `ILMerge` in a batch file:\n\nThe Visual Studio Developer Command Prompt is not needed here, as `msbuild` is not used.\n\n```\n@echo off\n\n:: this script needs https://www.nuget.org/packages/ilmerge\n\n:: set your target executable name (typically [projectname].exe)\nSET APP_NAME=myapp.exe\n\n:: Set build, used for directory. Typically Release or Debug\nSET ILMERGE_BUILD=Debug\n\n:: Set platform, typically x64\nSET ILMERGE_PLATFORM=x64\n\n:: set your NuGet ILMerge Version, this is the number from the package manager install, for example:\n:: PM\u003e Install-Package ilmerge -Version 3.0.29\n:: to confirm it is installed for a given project, see the packages.config file\nSET ILMERGE_VERSION=3.0.29\n\n:: the full ILMerge should be found here:\nSET ILMERGE_PATH=%USERPROFILE%\\.nuget\\packages\\ilmerge\\%ILMERGE_VERSION%\\tools\\net452\n:: dir \"%ILMERGE_PATH%\"\\ILMerge.exe\n\necho Merging %APP_NAME% ...\n\n:: add project DLL's starting with replacing the FirstLib with this project's DLL\n\"%ILMERGE_PATH%\"\\ILMerge.exe Bin\\%ILMERGE_PLATFORM%\\%ILMERGE_BUILD%\\%APP_NAME%  ^\n  /lib:Bin\\%ILMERGE_PLATFORM%\\%ILMERGE_BUILD%\\ ^\n  /out:%APP_NAME% ^\n  FirstLib.dll ^\n  mylib1.dll ^\n  Microsoft.lib2.dll ^\n  SomeOtherLib.dll ^\n  \\otherlibdir\\otherlib.dll \n\n\n:Done\ndir %APP_NAME%\n```\n\n\n","funding_links":[],"categories":["C#","C# #","C# (212)","开发"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnet%2FILMerge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnet%2FILMerge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnet%2FILMerge/lists"}