XperienceCommunity.AppSettingsJsonRegistration
1.0.1
dotnet add package XperienceCommunity.AppSettingsJsonRegistration --version 1.0.1
NuGet\Install-Package XperienceCommunity.AppSettingsJsonRegistration -Version 1.0.1
<PackageReference Include="XperienceCommunity.AppSettingsJsonRegistration" Version="1.0.1" />
paket add XperienceCommunity.AppSettingsJsonRegistration --version 1.0.1
#r "nuget: XperienceCommunity.AppSettingsJsonRegistration, 1.0.1"
// Install XperienceCommunity.AppSettingsJsonRegistration as a Cake Addin #addin nuget:?package=XperienceCommunity.AppSettingsJsonRegistration&version=1.0.1 // Install XperienceCommunity.AppSettingsJsonRegistration as a Cake Tool #tool nuget:?package=XperienceCommunity.AppSettingsJsonRegistration&version=1.0.1
Xperience appsettings.json Registration
This package provides a Kentico Xperience 13.0 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.
Dependencies
This package is compatible with ASP.NET Core 3.1 → ASP.NET Core 5 and is designed to be used with .NET Core / .NET 5 Console applications integrated with Kentico Xperience 13.0.
How to Use?
First, install the NuGet package in your ASP.NET Core project
dotnet add package XperienceCommunity.AppSettingsJsonRegistration
Create an
appsettings.json
file at the root of your console app project with theCMSConnectionString
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "ConnectionStrings": { "CMSConnectionString": "<your connection string here>" } }
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)<ItemGroup> <None Update="appsettings.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup>
Add the call to
CMSApplication.Init();
at the beginning of yourMain()
methodclass Program { static void Main(string[] args) { CMSApplication.Init(); // ... } }
This package also supports having a appsettings.local.json
which is optional and can be ignored in your source control.
It can also support User Secrets. First add the package to your application:
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.11" />
</ItemGroup>
Then right click on your project in Visual Studio and select "Manage User Secrets" to create the secrets file.
Secrets can also be managed for a project, outside of Visual Studio, at the commend line using the .NET CLI.
Contributions
If you discover a problem, please open an issue.
If you would like contribute to the code or documentation, please open a pull request.
References
Kentico Xperience
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Kentico.Xperience.Libraries (>= 13.0.0 && < 13.1.0)
- Microsoft.Extensions.Configuration.Json (>= 3.1.11)
- Microsoft.Extensions.Configuration.UserSecrets (>= 3.1.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 3,860 | 4/3/2022 |
1.0.1-prerelease-9-1 | 707 | 4/3/2022 |
1.0.1-prerelease-2086189913-8 | 666 | 4/3/2022 |
1.0.1-prerelease-2086137420-6 | 717 | 4/3/2022 |
1.0.0 | 1,242 | 10/20/2021 |