Mobile.Secrets
1.0.0
dotnet add package Mobile.Secrets --version 1.0.0
NuGet\Install-Package Mobile.Secrets -Version 1.0.0
<PackageReference Include="Mobile.Secrets" Version="1.0.0" />
<PackageVersion Include="Mobile.Secrets" Version="1.0.0" />
<PackageReference Include="Mobile.Secrets" />
paket add Mobile.Secrets --version 1.0.0
#r "nuget: Mobile.Secrets, 1.0.0"
#:package Mobile.Secrets@1.0.0
#addin nuget:?package=Mobile.Secrets&version=1.0.0
#tool nuget:?package=Mobile.Secrets&version=1.0.0
Mobile.Secrets
This small package is used to generate secrets from an appsettings file or your environment. This project is aimed to be used with MAUI. It can also be used in other projects/frameworks such as ASP.NET.
How to use
- Download this package from NuGet into your project.
- For local development, create an
appsettings.jsonfile in the root of your project, not your solution. - Build your application.
You will find a Settings.Generated.cs file in your obj directory. The secrets from your appsettings.json have been generated and compiled and are ready to use in your project.
To use this in your pipeline, simply add your secrets to your environment. The name of each secret should be prefixed with Secret_, that way Mobile.Secrets can find your secrets in your environment.
Notes
- I created this project because I was not able to migrate the Mobile.BuildTools package from Xamarin to MAUI. We were only using configuration, so I figured it would be interesting to create my own small solution. That being said, without the Mobile.BuildTools package I wouldn't have come far.
- It is possible use nested objects in your
appsettings.jsonfile. Keep in mind that the names of each object are chained together with an_. The nestedConnectionStringsin this testappsettingsfile are renamed toConnectionStrings_Defaultin the generated class. - Currently, arrays are unsupported and will not be generated.
Solution structure
This solution contains a couple of projects, these are:
Mobile.Secrets: the actual package.TestApplication: an application I used to do some local testing/development.UnitTests: mostly used for development and currently not intended for CI.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
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 |
|---|