-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
File-based apps are introduced in .NET 10, allowing for C# apps that are based on just a single .cs file and optionally other supporting content and settings files (e.g. [appname].settings.json, etc.). There is no project file (*.csproj) for these apps and they can be run directly via dotnet run app.cs or just dotnet app.cs.
dotnet user-secrets should be updated to support file-based apps so that it's simple to use user secrets with them. This will involve adding a -f, --file option to all commands to allow specifying the application file, e.g.:
dotnet user-secrets init -f app.csdotnet user-secrets set -f app.cs setting1=truedotnet user-secrets set -f app.cs setting1=true;setting2=truetype .\secrets.json | dotnet user-secrets set -f app.csdotnet user-secrets clear -f app.csdotnet user-secrets list -f app.csdotnet user-secrets remove -f app.cs setting1
Additionally, dotnet user-secrets should support working with file-based apps that don't have an explicit user secrets ID set by utilizing an implicit ID based on a hash of the full file path. This allows for the commands to work without first needing to run dotnet user-secrets init -f app.cs. If init is run, it should use the file path hash as the ID rather than a new GUID, unless the --id option is specified.