https://github.com/usausa/embedded-build-property
🐰Source generator for build options.
https://github.com/usausa/embedded-build-property
codegenerator source-generator source-generators sourcegenerator
Last synced: 6 days ago
JSON representation
🐰Source generator for build options.
- Host: GitHub
- URL: https://github.com/usausa/embedded-build-property
- Owner: usausa
- License: mit
- Created: 2023-06-04T07:40:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-10T04:24:29.000Z (2 months ago)
- Last Synced: 2025-05-04T21:49:38.447Z (15 days ago)
- Topics: codegenerator, source-generator, source-generators, sourcegenerator
- Language: C#
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EmbeddedBuildProperty
[](https://www.nuget.org/packages/EmbeddedBuildProperty)
## What is this?
Generate a method to get the properties specified in the build options.
## Usage
### Source
```cs
namespace Example;using EmbeddedBuildProperty;
internal static partial class Variants
{
[BuildProperty]
public static partial string Flavor();[BuildProperty("SecretKey")]
public static partial string Key();
}
```### Build
```
dotnet build Example.csproj /p:EmbeddedBuildProperty=\"Flavor=Free,SecretKey=12345678\"
```### Result
```cs
Console.WriteLine($"Flavor: {Variants.Flavor()}"); // Free
Console.WriteLine($"Key: {Variants.Key()}"); // 12345678
```## TODO
* Extend supported types
* Secret file support?