{"id":22176927,"url":"https://github.com/nullean/assembly-rewriter","last_synced_at":"2026-03-16T20:33:12.862Z","repository":{"id":56287235,"uuid":"134582039","full_name":"nullean/assembly-rewriter","owner":"nullean","description":"Rewrite .NET assemblies to allow referencing of two different versions","archived":false,"fork":false,"pushed_at":"2023-06-30T10:17:33.000Z","size":55,"stargazers_count":24,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-01T10:46:37.902Z","etag":null,"topics":["assembly","csharp","dll","dotnet","il-rewriting","mono-cecil","rewriting"],"latest_commit_sha":null,"homepage":"","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/nullean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-23T14:30:53.000Z","updated_at":"2024-03-29T00:07:19.000Z","dependencies_parsed_at":"2022-08-15T16:00:57.603Z","dependency_job_id":null,"html_url":"https://github.com/nullean/assembly-rewriter","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullean%2Fassembly-rewriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullean%2Fassembly-rewriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullean%2Fassembly-rewriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullean%2Fassembly-rewriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullean","download_url":"https://codeload.github.com/nullean/assembly-rewriter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227614685,"owners_count":17793949,"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":["assembly","csharp","dll","dotnet","il-rewriting","mono-cecil","rewriting"],"created_at":"2024-12-02T08:21:43.689Z","updated_at":"2026-03-16T20:33:12.830Z","avatar_url":"https://github.com/nullean.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# assembly-rewriter\n\nRewrites .NET assemblies with [Mono.Cecil](https://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/), to allow two different versions of the same assembly to be referenced within an application.\n \nIt assumes that the assembly DLL name is the top level namespace and rewrites\n\n1. the top level namespace for all types within the assembly\n2. assemblies in the order of dependencies first\n3. IL `ldstr` op codes if they start with the namespace\n4. compiler generated backing fields\n\nThis small program was written to allow different versions [Elasticsearch .NET clients](https://github.com/elastic/elasticsearch-net) to be rewritten for benchmark comparisons. \nYour mileage may vary rewriting other assemblies :)\n\n## Installation\n\n\nDistributed as a .NET tool so install using the following\n\n```\ndotnet tool install assembly-rewriter\n```\n\n## Run \n\n```bat\ndotnet assembly-rewriter\n```\n\nYou can omit `dotnet` if you install this as a global tool\n\n\n## Examples\n\nRewrite [NEST, the Elasticsearch .NET high level client](https://github.com/elastic/elasticsearch-net), version 6.2.0\n\n```c#\nassembly-rewriter -i C:/Nest.dll -o C:/Nest620.dll\n```\n\nNow, `Nest620.dll` and another version of `Nest.dll` can be referenced in the same project. \n\nThere's _a small issue here_ however; both versions of NEST rely on `Elasticsearch.Net.dll`, so we should also rewrite\nthis dependency at the same time, and update the references to Elasticsearch.Net within NEST to reference the new rewritten assembly\n\n```c#\nassembly-rewriter -i C:/Nest.dll -o C:/Nest620.dll -i C:/Elasticsearch.Net.dll -o C:/Elasticsearch.Net620.dll\n```\n\nGreat! Now we can reference both in the same project.\n\nIf there are other direct dependencies that may version clash, these can be passed as well\n\n```c#\nassembly-rewriter -i C:/Nest.dll -o C:/Nest620.dll -i C:/Elasticsearch.Net.dll -o C:/Elasticsearch.Net620.dll -i C:/Newtonsoft.Json.dll -o C:/Newtonsoft.Json620.dll\n```\n\n## Rewrite validation\n\nYou can check to see if everything expected has been rewritten using [IL Disassembler](https://docs.microsoft.com/en-us/dotnet/framework/tools/ildasm-exe-il-disassembler)\n\n```powershell\nildasm \u003crewritten\u003e.dll /OUT=\u003crewritten\u003e.il /NOBAR\nSelect-String -Path \u003crewritten\u003e.il -Pattern '\u003coriginal namespace\u003e\\.' -AllMatches | ft LineNumber,Line\n```\n\n## License\n\n[Apache 2.0](License.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullean%2Fassembly-rewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullean%2Fassembly-rewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullean%2Fassembly-rewriter/lists"}