Description
Is your feature request related to a problem? Please describe.
Issue: XML Conditional Processing Not Working in .slnx Files
Problem Description
I'm trying to use XML conditional processing format in a .slnx file within a .NET template, but it doesn't work as expected. Since .slnx files are XML-based, I expected the standard XML conditional processing syntax to work, but it seems the templating engine doesn't recognize .slnx files as XML for conditional processing purposes.
Steps to Reproduce
- Create a .NET template with a .slnx file
- Add conditional processing directives to the .slnx file using XML comment syntax:
<!--#if (api)--> <Folder Name="/05-ContainerApps/Api/"> <!-- Projects inside this folder --> </Folder> <!--#endif-->
- Generate a project from the template with the condition set to false (e.g.,
--api false
) - Observe that the conditional sections are not processed correctly - the comment directives are included in the output file, but the content between them is not excluded
Expected Behavior
When generating a project with --api false
, the entire section (including the conditional directives and the content between them) should be excluded from the generated .slnx file.
Actual Behavior
The conditional directives (<!--#if (api)-->
and <!--#endif-->
) are included in the output file as literal text, and the content between them is also included regardless of the condition value.
Environment
- .NET SDK version: 9.0.200
- OS: Windows 11 Pro
Additional Context
The .slnx file format is relatively new and appears to be an XML-based solution file format. Since it's XML-based, I expected it to work with the standard XML conditional processing syntax as described in the documentation: https://github.com/dotnet/templating/wiki/Conditional-processing-and-comment-syntax#xml-based-formats
I believe this issue occurs because the .slnx extension is not mapped to XML for conditional processing purposes in the templating engine.
Possible Solution
The templating engine could be updated to recognize .slnx files as XML-based files for conditional processing purposes, similar to how it handles .csproj, .vbproj, and other XML-based files.
Alternatively, if there's a different recommended approach for handling conditional content in .slnx files, documentation on this would be helpful.
Describe the solution you'd like.
The templating engine could be updated to recognize .slnx files as XML-based files for conditional processing purposes, similar to how it handles .csproj, .vbproj, and other XML-based files.
Additional context
No response