-
Notifications
You must be signed in to change notification settings - Fork 11
Support for parsing slnf files #86
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
Conversation
| <None Include="Serializer/Xml/Slnx.xsd" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> |
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.
in netcore, stj comes from shared framework
| <ItemGroup> | |
| <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> |
also update condition on line 10. this is a preferred way of checking the tfm flavor instead of hardcoding version https://github.com/search?q=repo:dotnet/sdk+TargetFrameworkIdentifier+language:XML&type=code
| internal SolutionModel Parse() | ||
| { | ||
| string originalSolutionPath = this.jsonNode["solution"]?["path"]?.GetValue<string>() ?? string.Empty; | ||
| string[] projectPaths = this.jsonNode["solution"]?["projects"]?.AsArray()?.GetValues<string>()?.ToArray<string>() ?? []; |
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.
| string[] projectPaths = this.jsonNode["solution"]?["projects"]?.AsArray()?.GetValues<string>()?.ToArray<string>() ?? []; | |
| IEnumerable<string> projectPaths = this.jsonNode["solution"]?["projects"]?.AsArray()?.GetValues<string>() ?? []; |
nit: unnecessary extra array copy due to ToArray
|
Is there anything I can to do help move this along? I'm currently working on adding slnf support to a dotnet CLI command, and am surprised that I have to duplicate effort because MSBuild's ProjectFile API doesn't have public APIs to get solution filter information, and this solution persistence library doesn't yet support it. |
|
There was a discussion about this general approach, and creating a solution filter serializer is probably not the right approach. This is because a solution filter file supplements a solution file and doesn't contain any project or configuration data. Having a subset of information is fine for tools reading the data, but a designer like Visual Studio or C# DevKit would not have enough information to update both the solution file and the solution filter. An approach that would work better would be to create a helper that combines the information from a solution filter and a SolutionModel to provide a filtered view over the list of projects. This would allow solution filters to be used with different solution serializers and keep enough information to be available for designers. This would probably take the form as a set of helpers instead of a serializer. However, currently supporting solution filters is out of scope. |
|
Update for people reading this in the future: dotnet/sdk#46002 |
Addresses #85
This adds a new Serializer for parsing .slnf files into
SolutionModelobjects. This includes reading the original solution file and filtering projects from there.