{"id":19414866,"url":"https://github.com/markpflug/sylvan.buildtools.resources","last_synced_at":"2025-04-09T18:18:01.830Z","repository":{"id":43105146,"uuid":"106347785","full_name":"MarkPflug/Sylvan.BuildTools.Resources","owner":"MarkPflug","description":"Build-time resource file support in C# projects.","archived":false,"fork":false,"pushed_at":"2024-09-20T15:20:40.000Z","size":155,"stargazers_count":70,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T18:17:55.353Z","etag":null,"topics":["csharp","dotnet","json","resx"],"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/MarkPflug.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-10-10T00:04:48.000Z","updated_at":"2024-11-28T09:02:36.000Z","dependencies_parsed_at":"2024-02-27T08:45:03.406Z","dependency_job_id":"691b241c-137a-4800-aaca-64e3d84ef714","html_url":"https://github.com/MarkPflug/Sylvan.BuildTools.Resources","commit_stats":{"total_commits":65,"total_committers":6,"mean_commits":"10.833333333333334","dds":"0.23076923076923073","last_synced_commit":"8a7cc66ea8abd8f06700cc80a771fad951afe965"},"previous_names":["markpflug/elemental.jsonresource"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPflug%2FSylvan.BuildTools.Resources","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPflug%2FSylvan.BuildTools.Resources/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPflug%2FSylvan.BuildTools.Resources/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPflug%2FSylvan.BuildTools.Resources/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkPflug","download_url":"https://codeload.github.com/MarkPflug/Sylvan.BuildTools.Resources/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085328,"owners_count":21045139,"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","dotnet","json","resx"],"created_at":"2024-11-10T12:40:10.471Z","updated_at":"2025-04-09T18:18:01.806Z","avatar_url":"https://github.com/MarkPflug.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sylvan.BuildTools.Resources\n\nProvides resource file support and code generation in C# projects.\nReferencing the `Sylvan.BuildTools.Resources` package will *not* \nadd a rumtine dependency to your project, nor\ncreate a transitive package dependency for your nuget package. \nThe package operates at build time and will embed resources in your output assembly, \nand includes compiled code files containing resource accessors.\n\n## Localized Resource .resj Files\n\nJSON resource files provides an alternative to using resx XML resource files to define resources in C# projects.\n\nThe benefits over resx are:\n\n- human authorable file format (resx is human readable, but diffcult to author without documentation or tooling support)\n- generated C# code doesn't get included in project/source control (unlike designer.cs files)\n- Doesn't require modifying the .csproj (adding a single resx file will add ~12 lines to your csproj file)\n- Implemented with build-time code-gen and doesn't require Visual Studio to function. (resx files require Visual Studio design time code gen)\n- Still get Intellisense in Visual Studio for the generated code.\n\nJSON resource files use the \".resj\" file extension, and a very simple json document to specify resources.\nCurrently supports strings and text files. Text file path should be specified relative to the resj file location. \nSupports creating localized satellite assemblies using the same naming convention as resx.\n\nExample files:\n\n`[Resources.resj]`\n```json\n{\n  \"Strings\": {\n    \"Greeting\": \"Hello, Resj\",\n    \"Farewell\": \"Goodbye, Resx\"\n  },\n  \"Files\": {\n    \"ComplexQuery\": \"sql/query.sql\"\n  }\n}\n```\n\n`[Resources.de-DE.resj]`\n```json\n{\n  \"Strings\": {\n    \"Greeting\": \"Hallo, Resj\",\n    \"Farewell\": \"Auf Wiedersehen, Resx\"\n  }\n}\n```\n\nYou can control the resource generation specifying a custom namespace, and the visibility of the generated class:\n\n```xml\n  \u003cItemGroup\u003e\n    \u003cJsonResource Update=\"Path/To/Resource.resj\"\u003e\n      \u003cAccessModifier\u003ePublic\u003c/AccessModifier\u003e\n      \u003cNamespace\u003eCustomNS\u003c/Namespace\u003e\n      \u003cResourceName\u003eCustomResourceName\u003c/ResourceName\u003e\n    \u003c/JsonResource\u003e\n  \u003c/ItemGroup\u003e\n```\n\n## Static String Code Generation\n\nThe static string code generation feature allows adding string constants to your project where each string constant\nis defined in a separate file in a folder structure. \nThis is intended to support scenarios where you need to include long string constants that contain structured language\nthat would be better maintained in a separate file, instead of inlining the code in a C# file. \nThis allows text like long SQL queries, chunks of HTML or JavaScript to be edited in a file with appropriate syntax highlighting,\nthen accessed from C# code as if it were defined as a native string constant.\n\nStatic resources are added to a project by defining a `StaticResourceFolder` item in the .csproj file, \nwhich names a folder that contains static resource files.\n\n```xml\n\t\u003cItemGroup\u003e\n\t\t\u003cStaticResourceFolder Include=\"Sql\"/\u003e\n\t\u003c/ItemGroup\u003e\n```\n\nIf the `Sql` folder contains a file named `select_user_data.sql` it would generate code roughly equivalent to the following:\n\n```\nnamespace ProjectRootNamespace {\n    class Sql {\n        public static readonly string SelectUserData = \"...\";\n    }\n}\n```\n\nThe generated code is compiled into the project assembly, but is not included in the project source code. The generated types/members will still be visible in intellisense in Visual Studio.\n\n## Release Notes:\n\n_0.6.2_\n- Fixes StaticResourceFolder handling of empty folders (#23).\n\n_0.6.1_\n- Adds `PreProcess` capability to StaticResourceFolder. \n- Improves error reporting for some malformed JSON scenarios.\n\n_0.6.0_\n - Adds support for generating static code from a folder holding static resources (non-localizable).\n\n_0.5.1_\n - Mark package as `DevelopmentDependency` so it doesn't become a transitive dependency for consuming packages.\n\n_0.5.0_\n - Project/package renamed to avoid name collision with technology from mega-corp.\n\n_0.4.0_ \n - Adds code comments to generated code, allowing projects that use WarningsAsErrors and DocumentationFile to compile without error.\n - Big thanks to [@teddybeermaniac](https://github.com/teddybeermaniac) for his contribution here.\n\n## Running Sylvan.BuildTools.Resources.Tests on Unix\n\nIf you'd like to develop Sylvan.BuildTools.Resources under Mono, and encounter issues with reference assemblies not being found while running tests, you might need to run something similar beforehand ([source1](https://stackoverflow.com/a/55070707), [source2](https://github.com/Microsoft/msbuild/issues/2728#issuecomment-345381357)):\n```sh\nexport FrameworkPathOverride=/lib/mono/4.6-api\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkpflug%2Fsylvan.buildtools.resources","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkpflug%2Fsylvan.buildtools.resources","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkpflug%2Fsylvan.buildtools.resources/lists"}