-
-
Notifications
You must be signed in to change notification settings - Fork 23
Support SLNX by using Microsoft.VisualStudio.SolutionPersistence #124
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
Merged
leonardochaia
merged 5 commits into
leonardochaia:main
from
nicholass-alcidion:support-slnx
Jul 21, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
03236e6
support slnx by using ms.visualstudio.solutionpersistance
nicholass-alcidion 0b330c5
compute absolute path for projects found in solution
nicholass-alcidion 8f2f78e
bump solution persistance version
nicholass-alcidion 1452391
switch to notsupportedexception
nicholass-alcidion 0d7a15f
Add SLNX Tests
nicholass-alcidion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 16 additions & 5 deletions
21
src/DotnetAffected.Core/ProjectDiscovery/SolutionFileProjectDiscoverer.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
test/DotnetAffected.Core.Tests/ChangeDetectionUsingXmlSolutionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| using DotnetAffected.Testing.Utils; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using Xunit; | ||
|
|
||
| namespace DotnetAffected.Core.Tests | ||
| { | ||
| /// <summary> | ||
| /// Tests for detecting changed projects when using a SolutionFile to filter. | ||
| /// This should cover all tests where filtering should be applied | ||
| /// </summary> | ||
| public class ChangeDetectionUsingXmlSolutionTests | ||
| : BaseDotnetAffectedTest | ||
| { | ||
| private readonly string _solutionPath = "test-solution.slnx"; | ||
|
|
||
| protected override AffectedOptions Options => new AffectedOptions( | ||
| this.Repository.Path, | ||
| Path.Combine(this.Repository.Path, this._solutionPath)); | ||
|
|
||
| [Fact] | ||
| public async Task When_project_inside_solution_has_changes_project_should_have_changed() | ||
| { | ||
| // Create a project | ||
| var projectName = "InventoryManagement"; | ||
| var msBuildProject = this.Repository.CreateCsProject(projectName); | ||
|
|
||
| // Create a solution which includes the project | ||
| await this.Repository.CreateXmlSolutionAsync(_solutionPath, msBuildProject.FullPath); | ||
|
|
||
| Assert.Single(AffectedSummary.ProjectsWithChangedFiles); | ||
| Assert.Empty(AffectedSummary.AffectedProjects); | ||
|
|
||
| var projectInfo = AffectedSummary.ProjectsWithChangedFiles.Single(); | ||
| Assert.Equal(projectName, projectInfo.GetProjectName()); | ||
| Assert.Equal(msBuildProject.FullPath, projectInfo.GetFullPath()); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task When_project_inside_solution_should_ignore_changes_outside_solution() | ||
| { | ||
| // Create a project | ||
| var projectName = "InventoryManagement"; | ||
| var msBuildProject = this.Repository.CreateCsProject(projectName); | ||
|
|
||
| // Create a solution which includes the project | ||
| await this.Repository.CreateXmlSolutionAsync(_solutionPath, msBuildProject.FullPath); | ||
|
|
||
| // Create a project that is outside the solution | ||
| var outsiderproject = "OutsiderProject"; | ||
| this.Repository.CreateCsProject(outsiderproject); | ||
|
|
||
| Assert.Single(AffectedSummary.ProjectsWithChangedFiles); | ||
| Assert.Empty(AffectedSummary.AffectedProjects); | ||
|
|
||
| var projectInfo = AffectedSummary.ProjectsWithChangedFiles.Single(); | ||
| Assert.Equal(projectName, projectInfo.GetProjectName()); | ||
| Assert.Equal(msBuildProject.FullPath, projectInfo.GetFullPath()); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task When_project_outside_solution_has_changed_nothing_should_be_affected() | ||
| { | ||
| // Create a project | ||
| var projectName = "InventoryManagement"; | ||
| var msBuildProject = this.Repository.CreateCsProject(projectName); | ||
|
|
||
| // Create a solution which includes the project | ||
| await this.Repository.CreateXmlSolutionAsync(_solutionPath, msBuildProject.FullPath); | ||
|
|
||
| // Commit so there are no changes | ||
| this.Repository.StageAndCommit(); | ||
|
|
||
| // Create a project that is outside the solution | ||
| var outsiderName = "OutsiderProject"; | ||
| this.Repository.CreateCsProject(outsiderName); | ||
|
|
||
| Assert.Empty(AffectedSummary.AffectedProjects); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
it would probably be better to go through the full async/await way that getting the awaiter and result