-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add PostAction for dotnet.config #50285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PostAction for dotnet.config #50285
Conversation
2d51c0b
to
b344815
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new PostAction processor for creating or updating dotnet.config files in template generation scenarios. The feature allows templates to automatically configure dotnet.config settings for specific sections, keys, and values.
Key Changes
- Adds
CreateOrUpdateDotnetConfigPostActionProcessor
that handles creating new dotnet.config files or updating existing ones - Implements comprehensive test coverage for various scenarios including missing arguments, file creation, section updates, and no-op cases
- Adds localized error and success messages for the new functionality
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
CreateOrUpdateDotnetConfigPostActionProcessor.cs |
Core implementation of the new post-action processor with config file manipulation logic |
CreateOrUpdateDotnetConfigPostActionTests.cs |
Comprehensive unit tests covering all processor scenarios |
Microsoft.TemplateEngine.Cli.csproj |
Added dependency on Microsoft.Extensions.Configuration.Ini package |
LocalizableStrings.resx |
Added new localizable strings for success/error messages |
Components.cs |
Registered the new processor in the component collection |
Multiple .xlf files |
Localization files updated with new translation entries |
Files not reviewed (1)
- src/Cli/Microsoft.TemplateEngine.Cli/LocalizableStrings.Designer.cs: Language not supported
...oft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs
Outdated
Show resolved
Hide resolved
...oft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs
Outdated
Show resolved
Hide resolved
@dotnet/templating-engine-maintainers @mariam-abdulla @nohwnd Please review |
...oft.TemplateEngine.Cli/PostActionProcessors/CreateOrUpdateDotnetConfigPostActionProcessor.cs
Outdated
Show resolved
Hide resolved
@dotnet/templating-engine-maintainers Can I please have a review here? |
The linked issue mentions .NET 10, main is currently .NET 11. This would need to be ported for RC2 if it needs to be included in 10.0 I think |
@joeloff Yes I'll backport after merge. And for next PRs I'll target release/10.0.1xx right away |
Suggestion: Looking at the post action that adds project to solution, there are some more things that will need to happen (probably), adding the guid of the post action to templating schema. And the tests that actually use the action would also be nice to have here: https://grep.app/search?f.repo.pattern=dotnet%2F&q=D396686C-DE0E-4DE6-906D-291CD29FC5DE Maybe if this post action moved to the location of https://github.com/dotnet/sdk/blob/main/src/Cli/dotnet/Commands/New/PostActions/DotnetSlnPostActionProcessor.cs#L24 it would be nice to re-use that infrastructure and do it the same. |
@nohwnd I addressed your feedback on adding more tests, and opened a doc update on dotnet/templating dotnet/templating#9274. For reusing logic from DotnetSlnPostActionPreprocessor, my logic here is quite different, which is more suitable for 'dotnet.config' IMO. Ping @dotnet/templating-engine-maintainers @marcpopMSFT any concerns merging this? |
…teOrUpdateDotnetConfigPostActionProcessor.cs
Co-authored-by: Jacques Eloff <[email protected]>
bd6e74f
to
0c27bcc
Compare
Related to #50054