{"id":30028707,"url":"https://github.com/quickz/cshtml-class-library-example","last_synced_at":"2026-02-08T12:36:42.374Z","repository":{"id":305036836,"uuid":"1021713295","full_name":"Quickz/cshtml-class-library-example","owner":"Quickz","description":"An example of how to use ASP.NET Core MVC project views from a razor class library.","archived":false,"fork":false,"pushed_at":"2025-07-17T21:54:39.000Z","size":1029,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-18T00:07:30.259Z","etag":null,"topics":["asp-net-core","asp-net-core-mvc","cshtml","example","razor","reuse"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/Quickz.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,"zenodo":null}},"created_at":"2025-07-17T20:35:32.000Z","updated_at":"2025-07-17T21:54:43.000Z","dependencies_parsed_at":"2025-07-18T02:17:35.706Z","dependency_job_id":"c607d8fa-e1e5-457a-8bf1-53ea82affd61","html_url":"https://github.com/Quickz/cshtml-class-library-example","commit_stats":null,"previous_names":["quickz/cshtml-class-library-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Quickz/cshtml-class-library-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quickz%2Fcshtml-class-library-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quickz%2Fcshtml-class-library-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quickz%2Fcshtml-class-library-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quickz%2Fcshtml-class-library-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quickz","download_url":"https://codeload.github.com/Quickz/cshtml-class-library-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quickz%2Fcshtml-class-library-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269108974,"owners_count":24361233,"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","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asp-net-core","asp-net-core-mvc","cshtml","example","razor","reuse"],"created_at":"2025-08-06T15:59:08.050Z","updated_at":"2026-02-08T12:36:37.355Z","avatar_url":"https://github.com/Quickz.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cshtml file re-use example\n\nAn example of how to use ASP.NET Core MVC project views from a razor class library.\n\n## Enabling run-time compilation\n\n### How to enable run-time compilation for the MVC project\n#### 1. Install this NuGet package on to the MVC project\n```\nMicrosoft.AspNetCore.Mvc.Razor.RuntimeCompilation\n```\n\n#### 2. Add this on the startup file\n```csharp\nbuilder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();\n```\n\u003cimg width=\"1069\" height=\"162\" alt=\"image\" src=\"https://github.com/user-attachments/assets/7dff6744-8274-4abc-bbed-6faec498d1d7\" /\u003e\n\n### How to enable run-time compilation for the razor class library\n#### 1. Install this NuGet package on to the razor class library\n```\nMicrosoft.AspNetCore.Mvc.Razor.RuntimeCompilation\n```\n\n#### 2. Update MVC project startup file to include this\n```csharp\nbuilder.Services.AddControllersWithViews().AddRazorRuntimeCompilation(options =\u003e\n{\n    // Used to enable run-time compilation for the razor class library views.\n    // If removed run-time compilation will only be available for the main project.\n    if (builder.Environment.IsDevelopment())\n    {\n        var path = Path.Combine(\n            builder.Environment.ContentRootPath,\n            \"../SharedViews\");\n        var fileProvider = new PhysicalFileProvider(path);\n        options.FileProviders.Add(fileProvider);\n    }\n});\n```\n\u003cimg width=\"976\" height=\"242\" alt=\"image\" src=\"https://github.com/user-attachments/assets/d5f22a2c-65e6-498b-9f8e-b4185cef8a74\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickz%2Fcshtml-class-library-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquickz%2Fcshtml-class-library-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickz%2Fcshtml-class-library-example/lists"}