{"id":15037448,"url":"https://github.com/dotnetcore/natasha","last_synced_at":"2025-04-23T20:53:44.266Z","repository":{"id":38272809,"uuid":"83676668","full_name":"dotnetcore/Natasha","owner":"dotnetcore","description":"基于 Roslyn 的 C# 动态程序集构建库，该库允许开发者在运行时使用 C# 代码构建域 / 程序集 / 类 / 结构体 / 枚举 / 接口 / 方法等，使得程序在运行的时候可以增加新的模块及功能。Natasha 集成了域管理/插件管理，可以实现域隔离，域卸载，热拔插等功能。 该库遵循完整的编译流程，提供完整的错误提示， 可自动添加引用，完善的数据结构构建模板让开发者只专注于程序集脚本的编写，兼容 stanadard2.0 / netcoreapp3.0+, 跨平台，统一、简便的链式 API。 且我们会尽快修复您的问题及回复您的 issue.","archived":false,"fork":false,"pushed_at":"2025-02-25T00:02:06.000Z","size":29334,"stargazers_count":1552,"open_issues_count":8,"forks_count":225,"subscribers_count":66,"default_branch":"main","last_synced_at":"2025-04-23T20:53:30.241Z","etag":null,"topics":["csharp","dotnetcore","dynamic","hacktoberfest","il","roslyn","script"],"latest_commit_sha":null,"homepage":"https://natasha.dotnetcore.xyz/","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/dotnetcore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE-OF-CONDUCT.md","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,"zenodo":null}},"created_at":"2017-03-02T12:42:53.000Z","updated_at":"2025-04-22T02:47:56.000Z","dependencies_parsed_at":"2023-02-19T03:31:04.736Z","dependency_job_id":"ebbcd305-0e2f-45ba-a156-437c2d4923da","html_url":"https://github.com/dotnetcore/Natasha","commit_stats":{"total_commits":2403,"total_committers":13,"mean_commits":"184.84615384615384","dds":0.03953391593841027,"last_synced_commit":"d21f943c3a9e5ef8243755a3a580a1a952d90a0e"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FNatasha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FNatasha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FNatasha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FNatasha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotnetcore","download_url":"https://codeload.github.com/dotnetcore/Natasha/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514767,"owners_count":21443208,"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":["csharp","dotnetcore","dynamic","hacktoberfest","il","roslyn","script"],"created_at":"2024-09-24T20:34:38.880Z","updated_at":"2025-04-23T20:53:44.242Z","avatar_url":"https://github.com/dotnetcore.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n  \u003cspan\u003e中文\u003c/span\u003e |  \n  \u003ca href=\"https://github.com/dotnetcore/natasha/tree/main/lang/english\"\u003eEnglish\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e \u003cspan\u003e你们的反馈是我的动力，文档还有很多不足之处；\u003c/span\u003e \u003c/p\u003e\n\u003cp align=\"center\"\u003e \u003cspan\u003e 当你看完文档之后仍然不知道如何实现你的需求，您可以查看\u003ca href=\"https://github.com/dotnetcore/Natasha/blob/main/docs/FAQ.md\"\u003e FAQ \u003c/a\u003e或者在issue中提出你的需求。\u003c/span\u003e \u003c/p\u003e\n  \n\u003cbr/\u003e  \n\n\n# Natasha \n[![Member project of .NET Core Community](https://img.shields.io/badge/member%20project%20of-NCC-9e20c9.svg)](https://github.com/dotnetcore)\n[![Gitter](https://badges.gitter.im/dotnetcore/natasha.svg)](https://gitter.im/dotnetcore/Natasha?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n[![Badge](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu/#/zh_CN)\n[![GitHub license](https://img.shields.io/github/license/dotnetcore/natasha.svg)](https://github.com/dotnetcore/Natasha/blob/main/LICENSE)\n[![wiki](https://img.shields.io/badge/wiki-ch-blue.svg)](https://natasha.dotnetcore.xyz/)\n\u003cbr/\u003e\n![Compile](https://img.shields.io/badge/script-csharp-green.svg)\n[![NuGet Badge](https://img.shields.io/nuget/dt/DotNetCore.Natasha.CSharp.Compiler?includePreReleases=true)](https://www.nuget.org/packages/DotNetCore.Natasha.CSharp.Compiler)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/dotnetcore/natasha.svg)](https://github.com/dotnetcore/Natasha/commits/main) \n[![Codecov](https://img.shields.io/codecov/c/github/dotnetcore/natasha.svg)](https://codecov.io/gh/dotnetcore/Natasha) \n[![UT Test From PR](https://github.com/dotnetcore/Natasha/actions/workflows/pr_test.yml/badge.svg)](https://github.com/dotnetcore/Natasha/actions/workflows/pr_test.yml)\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\u0026ensp;\u0026ensp;\u0026ensp;\u0026ensp;基于  [Roslyn](https://github.com/dotnet/roslyn)  的 C# 动态程序集构建库，该库允许开发者在运行时使用 C# 代码构建域 / 程序集 / 类 / 结构体 / 枚举 / 接口 / 方法等，使得程序在运行的时候可以增加新的模块及功能。Natasha 集成了域管理/插件管理，可以实现域隔离，域卸载，热拔插等功能。 该库遵循完整的编译流程，提供完整的错误提示， 可自动添加引用，完善的数据结构构建模板让开发者只专注于程序集脚本的编写，兼容 netstandard2.0, 跨平台，统一、简便的链式 API。 且我们会尽快修复您的问题及回复您的 [issue](https://github.com/dotnetcore/Natasha/issues/new) .  [这里有更多的使用文档](https://natasha.dotnetcore.xyz/zh-Hans/docs)\n\n![展示](https://images.gitee.com/uploads/images/2020/1201/161046_e8f52622_1478282.gif)\n\n\u003cbr/\u003e\n\n## 使用\n\n引入包 `DotNetCore.Natasha.CSharp.Compiler` 编译单元主体\n\n\u003cbr/\u003e\n\n引入包 `DotNetCore.Natasha.CSharp.Compiler.Domain` 编译域 (netcore3.1+)\n\n#### 初始化（v9）\n```cs\nNatashaManagement\n    //获取链式构造器\n    .GetInitializer() \n    //使用引用程序集中的命名空间\n    .WithMemoryUsing()\n    //使用内存中的元数据\n    .WithMemoryReference()\n    //注册域构造器\n    .Preheating\u003cNatashaDomainCreator\u003e();\n```\n\n#### 动态编译\n```cs\nAssemblyCSharpBuilder assemblyCSharp = new();\nassemblyCSharp.ConfigLoadContext(ctx =\u003e ctx.AddReferenceAndUsingCode\u003cobject\u003e());\nassemblyCSharp.Add(\"public class A{public void Show(){}}\");\nassemblyCSharp.LogCompilationEvent += (log) =\u003e { Console.WriteLine(log.ToString()); };\nvar newAssembly = assemblyCSharp.GetAssembly();\n```\n\u003cbr/\u003e\n\n## 赞助\n\n关闭打赏\n\n#### 捐助明细  \n\n- L*u 50 元\n- 亮 20 元\n- 升讯威在线客服系统 5 元\n- Json-jh [尊敬的博客园VIP会员] 22 元\n- [Newbe俞佬](https://github.com/newbe36524) 90.2 元 \n- 崔星星 17 元\n- Money 100 元\n- [Newbe俞佬](https://github.com/newbe36524) 200 元 \n- iNeuOS工业互联网平台 100 元 \n- 老萌 30 元\n- ****天下 10 元  \n- 文航 5 元\n- TonyQu 10 元\n- Rwing 20 元  \n\n 感谢老铁们的支持，感激不尽 🙏🙏🙏。\n  \n\u003cbr/\u003e  \n\n---------------------  \n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdotnetcore%2FNatasha.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdotnetcore%2FNatasha?ref=badge_large)          \n      \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetcore%2Fnatasha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnetcore%2Fnatasha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetcore%2Fnatasha/lists"}