{"id":19101114,"url":"https://github.com/dsplaisted/strongnamer","last_synced_at":"2025-05-15T13:02:57.218Z","repository":{"id":46412817,"uuid":"44928229","full_name":"dsplaisted/strongnamer","owner":"dsplaisted","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-15T15:30:59.000Z","size":114,"stargazers_count":325,"open_issues_count":40,"forks_count":52,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-05-16T09:02:40.818Z","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/dsplaisted.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-25T20:26:23.000Z","updated_at":"2024-05-13T18:10:00.000Z","dependencies_parsed_at":"2024-11-09T03:56:37.708Z","dependency_job_id":"8a1cf61e-cd2b-466d-8281-0c0da9a772f9","html_url":"https://github.com/dsplaisted/strongnamer","commit_stats":{"total_commits":58,"total_committers":13,"mean_commits":4.461538461538462,"dds":0.7068965517241379,"last_synced_commit":"7c8f96199a6e22e01963414bc6b23478ad79a497"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsplaisted%2Fstrongnamer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsplaisted%2Fstrongnamer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsplaisted%2Fstrongnamer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsplaisted%2Fstrongnamer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsplaisted","download_url":"https://codeload.github.com/dsplaisted/strongnamer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248977729,"owners_count":21192652,"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-11-09T03:53:10.221Z","updated_at":"2025-04-14T23:29:41.635Z","avatar_url":"https://github.com/dsplaisted.png","language":"C#","funding_links":[],"categories":["others","Strong Naming","强命名"],"sub_categories":[],"readme":"# Strong Namer\n\nMost applications in .NET [do not need to be strong named][1].  Strong names can\nalso introduce pain because they end up requiring binding redirects.  Because of\nthis, many OSS libraries do not strong name their assemblies.\n\n[1]: https://github.com/dotnet/corefx/blob/c02d33b18398199f6acc17d375dab154e9a1df66/Documentation/project-docs/strong-name-signing.md#faq\n\nStrong named assemblies that reference assemblies that aren't strong named are\nrejected by the .NET Framework (desktop app only restriction).\nSo if for whatever reason you actually do need to strong name your project, you\ncouldn't easily consume open source packages.\n\nStrong Namer is a NuGet package which aims to change this.  Simply install the\n[StrongNamer](https://www.nuget.org/packages/strongnamer) NuGet package, and\nit will transparently and automatically sign the assemblies you reference as\npart of the build process.\n\n# Demo\n\nHere's how to try Strong Namer out for yourself:\n\n- Create a new Console application\n- Add a strong name to the application\n  - *Go to the Signing tab of the project properties*\n  - *Check \"Sign the assembly\"*\n  - *In the key file dropdown, choose \u0026lt;New...\u0026gt;*\n  - *Choose a key file name (ie \"key.snk\"), uncheck the password option,\n     and click OK*\n- Add a reference to the [Octokit](https://www.nuget.org/packages/octokit)\n  NuGet package\n- Replace Program class with the following code:\n\n``` C#\nusing Octokit;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n    static void Main(string[] args)\n    {\n        MainAsyncWithErrorHandling().Wait();\n    }\n\n    static async Task MainAsyncWithErrorHandling()\n    {\n        try\n        {\n            await MainAsync();\n        }\n        catch (Exception ex)\n        {\n            Console.WriteLine(ex.ToString());\n        }\n    }\n\n    static async Task MainAsync()\n    {\n        var github = new GitHubClient(new ProductHeaderValue(\"MyAmazingApp\"));\n        var user = await github.User.Get(\"half-ogre\");\n        Console.WriteLine(user.Followers + \" folks love the half ogre!\");\n    }\n}\n```\n- Start without debugging (CTRL+F5)\n\n![System.IO.FileLoadException: Could not load file or assembly 'Octokit, Version=0.16.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)\nFile name: 'Octokit, Version=0.16.0.0, Culture=neutral, PublicKeyToken=null'\n   at Program.MainAsync()\n   at Program.\u003cMainAsyncWithErrorHandling\u003ed__1.MoveNext() in C:\\Users\\daplaist\\Documents\\Visual Studio 2015\\Projects\\ConsoleApplication13\\ConsoleApplication13\\Program.cs:line 19](images/StrongNameSadPanda.png)\n- :disappointed:\n- Add a reference to the [StrongNamer](https://www.nuget.org/packages/strongnamer)\n  NuGet package\n- Start without debugging (CTRL+F5)\n\n![75 folks love the half ogre!](images/StrongNameSuccessSparkles.png)\n- :sparkles: :fireworks: :smile: :fireworks: :sparkles:\n\n# How does it work?\n\nThe NuGet package includes an MSBuild targets file and task which hook into the\nbuild process and add a strong name to any references which aren't strong named\njust before they are passed to the compiler.\n\nThe task uses Mono.Cecil to do this.  Credit goes to [Nivot.StrongNaming](https://github.com/oising/strongnaming) for showing me how\nto do this.\n\n# Options\n\nYou can conditionally disable automated signing of unsigned packages by setting the \"DisableStrongNamer\" property to \"true\".  This is particularly useful if you have a custom build configuration for your application (e.g., you only wish for unsigned packages to be autosigned in specific environments).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsplaisted%2Fstrongnamer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsplaisted%2Fstrongnamer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsplaisted%2Fstrongnamer/lists"}