{"id":21328422,"url":"https://github.com/wiredviews/xperience-appsettings-json-registration","last_synced_at":"2025-04-14T23:42:31.091Z","repository":{"id":98317846,"uuid":"321147676","full_name":"wiredviews/xperience-appsettings-json-registration","owner":"wiredviews","description":"This package provides an Xperience custom module to auto-register the ASPNET Core appsettings.json as Xperience's configuration source. This is useful in Console applications which do not use an IHostBuilder to configure the application.","archived":false,"fork":false,"pushed_at":"2022-04-03T19:09:07.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T23:42:18.663Z","etag":null,"topics":["dotnet","kentico-xperience"],"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/wiredviews.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":"2020-12-13T19:52:50.000Z","updated_at":"2023-11-15T21:24:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfd19322-4a5f-4d4c-a834-bf33606409f5","html_url":"https://github.com/wiredviews/xperience-appsettings-json-registration","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiredviews%2Fxperience-appsettings-json-registration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiredviews%2Fxperience-appsettings-json-registration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiredviews%2Fxperience-appsettings-json-registration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiredviews%2Fxperience-appsettings-json-registration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wiredviews","download_url":"https://codeload.github.com/wiredviews/xperience-appsettings-json-registration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981259,"owners_count":21193143,"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":["dotnet","kentico-xperience"],"created_at":"2024-11-21T21:28:53.235Z","updated_at":"2025-04-14T23:42:31.074Z","avatar_url":"https://github.com/wiredviews.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xperience appsettings.json Registration\n\n[![GitHub Actions CI: Build](https://github.com/wiredviews/xperience-appsettings-json-registration/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/wiredviews/xperience-appsettings-json-registration/actions/workflows/ci.yml)\n\n[![Publish Packages to NuGet](https://github.com/wiredviews/xperience-appsettings-json-registration/actions/workflows/publish.yml/badge.svg?branch=main)](https://github.com/wiredviews/xperience-appsettings-json-registration/actions/workflows/publish.yml)\n\n[![NuGet Package](https://img.shields.io/nuget/v/XperienceCommunity.AppSettingsJsonRegistration.svg)](https://www.nuget.org/packages/XperienceCommunity.AppSettingsJsonRegistration)\n\nThis package provides a [Kentico Xperience 13.0](https://docs.xperience.io/developing-websites/developing-xperience-applications-using-asp-net-core/) custom module to auto-register the ASPNET Core appsettings.json as Xperience's configuration source.\n\nThis is useful in [Console applications](https://docs.xperience.io/developing-websites/developing-xperience-applications-using-asp-net-core/starting-with-asp-net-core-development#StartingwithASP.NETCoredevelopment-Workingwithapplicationsettings) which do not use an IHostBuilder to configure the application.\n\n## Dependencies\n\nThis package is compatible with ASP.NET Core 3.1 -\u003e ASP.NET Core 5 and is designed to be used with .NET Core / .NET 5 Console applications integrated with Kentico Xperience 13.0.\n\n## How to Use?\n\n1. First, install the NuGet package in your ASP.NET Core project\n\n   ```bash\n   dotnet add package XperienceCommunity.AppSettingsJsonRegistration\n   ```\n\n1. Create an `appsettings.json` file at the root of your console app project with the `CMSConnectionString`\n\n   ```json\n   {\n     \"Logging\": {\n       \"LogLevel\": {\n         \"Default\": \"Information\",\n         \"Microsoft\": \"Warning\",\n         \"Microsoft.Hosting.Lifetime\": \"Information\"\n       }\n     },\n     \"ConnectionStrings\": {\n       \"CMSConnectionString\": \"\u003cyour connection string here\u003e\"\n     }\n   }\n   ```\n\n1. Ensure the `appsettings.json` file is configured to copy to the output directory on build by editing your console application's `.csproj` file and adding the following (if it doesn't already exist)\n\n   ```xml\n   \u003cItemGroup\u003e\n        \u003cNone Update=\"appsettings.json\"\u003e\n            \u003cCopyToOutputDirectory\u003ePreserveNewest\u003c/CopyToOutputDirectory\u003e\n        \u003c/None\u003e\n   \u003c/ItemGroup\u003e\n   ```\n\n1. Add the call to `CMSApplication.Init();` at the beginning of your `Main()` method\n\n   ```csharp\n   class Program\n   {\n       static void Main(string[] args)\n       {\n           CMSApplication.Init();\n\n           // ...\n       }\n   }\n   ```\n\nThis package also supports having a `appsettings.local.json` which is optional and can be ignored in your source control.\n\nIt can also support [User Secrets](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-3.1\u0026tabs=windows). First add the package to your application:\n\n```xml\n\u003cItemGroup\u003e\n    \u003cPackageReference Include=\"Microsoft.Extensions.Configuration.UserSecrets\" Version=\"3.1.11\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\nThen right click on your project in Visual Studio and select \"Manage User Secrets\" to create the secrets file.\n\nSecrets can also be managed for a project, outside of Visual Studio, [at the commend line](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-3.1\u0026tabs=windows#enable-secret-storage) using the .NET CLI.\n\n## Contributions\n\nIf you discover a problem, please [open an issue](https://github.com/wiredviews/xperience-appsettings-json-registration/issues/new).\n\nIf you would like contribute to the code or documentation, please [open a pull request](https://github.com/wiredviews/xperience-appsettings-json-registration/compare).\n\n## References\n\n### Kentico Xperience\n\n- [Working with application settings](https://docs.xperience.io/developing-websites/developing-xperience-applications-using-asp-net-core/starting-with-asp-net-core-development#StartingwithASP.NETCoredevelopment-Workingwithapplicationsettings)\n- [Using the MSBuild `\u003cAssemblyAttribute\u003e`](https://devnet.kentico.com/questions/kentico-13-why-i-can-t-get-the-current-page-type-only-the-treenode)\n- [Using the Xperience API externally](https://docs.xperience.io/integrating-3rd-party-systems/using-the-xperience-api-externally)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiredviews%2Fxperience-appsettings-json-registration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiredviews%2Fxperience-appsettings-json-registration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiredviews%2Fxperience-appsettings-json-registration/lists"}