@@ -709,6 +709,127 @@ await TestDiscoveryAsync(
709
709
) ;
710
710
}
711
711
712
+ [ Fact ]
713
+ public async Task TestRepo_DirectDiscovery_Slnx ( )
714
+ {
715
+ var solutionPath = "solution.slnx" ;
716
+ await TestDiscoveryAsync (
717
+ experimentsManager : new ExperimentsManager ( ) { UseDirectDiscovery = true } ,
718
+ packages :
719
+ [
720
+ MockNuGetPackage . CreateSimplePackage ( "Some.Package" , "9.0.1" , "net7.0" ) ,
721
+ ] ,
722
+ workspacePath : "" ,
723
+ files : new [ ]
724
+ {
725
+ ( "src/project.csproj" , """
726
+ <Project Sdk="Microsoft.NET.Sdk">
727
+ <PropertyGroup>
728
+ <TargetFrameworks>net7.0;net8.0</TargetFrameworks>
729
+ </PropertyGroup>
730
+
731
+ <ItemGroup>
732
+ <PackageReference Include="Some.Package" />
733
+ </ItemGroup>
734
+ </Project>
735
+ """ ) ,
736
+ ( "Directory.Build.props" , "<Project />" ) ,
737
+ ( "Directory.Packages.props" , """
738
+ <Project>
739
+ <PropertyGroup>
740
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
741
+ <SomePackageVersion>9.0.1</SomePackageVersion>
742
+ </PropertyGroup>
743
+
744
+ <ItemGroup>
745
+ <PackageVersion Include="Some.Package" Version="$(SomePackageVersion)" />
746
+ </ItemGroup>
747
+ </Project>
748
+ """ ) ,
749
+ ( solutionPath , """
750
+ <Solution>
751
+ <Folder Name="/src/">
752
+ <Project Path="src/project.csproj" />
753
+ </Folder>
754
+ </Solution>
755
+ """ ) ,
756
+ ( "global.json" , """
757
+ {
758
+ "sdk": {
759
+ "version": "6.0.405",
760
+ "rollForward": "latestPatch"
761
+ },
762
+ "msbuild-sdks": {
763
+ "My.Custom.Sdk": "5.0.0",
764
+ "My.Other.Sdk": "1.0.0-beta"
765
+ }
766
+ }
767
+ """ ) ,
768
+ ( ".config/dotnet-tools.json" , """
769
+ {
770
+ "version": 1,
771
+ "isRoot": true,
772
+ "tools": {
773
+ "microsoft.botsay": {
774
+ "version": "1.0.0",
775
+ "commands": [
776
+ "botsay"
777
+ ]
778
+ },
779
+ "dotnetsay": {
780
+ "version": "2.1.3",
781
+ "commands": [
782
+ "dotnetsay"
783
+ ]
784
+ }
785
+ }
786
+ }
787
+ """ ) ,
788
+ } ,
789
+ expectedResult : new ( )
790
+ {
791
+ Path = "" ,
792
+ Projects = [
793
+ new ( )
794
+ {
795
+ FilePath = "src/project.csproj" ,
796
+ TargetFrameworks = [ "net7.0" , "net8.0" ] ,
797
+ Dependencies = [
798
+ new ( "Some.Package" , "9.0.1" , DependencyType . PackageReference , TargetFrameworks : [ "net7.0" ] , IsDirect : true ) ,
799
+ new ( "Some.Package" , "9.0.1" , DependencyType . PackageReference , TargetFrameworks : [ "net8.0" ] , IsDirect : true ) ,
800
+ ] ,
801
+ Properties = [
802
+ new ( "TargetFrameworks" , "net7.0;net8.0" , "src/project.csproj" )
803
+ ] ,
804
+ ReferencedProjectPaths = [ ] ,
805
+ ImportedFiles = [
806
+ "../Directory.Build.props" ,
807
+ "../Directory.Packages.props" ,
808
+ ] ,
809
+ AdditionalFiles = [ ] ,
810
+ }
811
+ ] ,
812
+ GlobalJson = new ( )
813
+ {
814
+ FilePath = "global.json" ,
815
+ Dependencies = [
816
+ new ( "Microsoft.NET.Sdk" , "6.0.405" , DependencyType . MSBuildSdk ) ,
817
+ new ( "My.Custom.Sdk" , "5.0.0" , DependencyType . MSBuildSdk ) ,
818
+ new ( "My.Other.Sdk" , "1.0.0-beta" , DependencyType . MSBuildSdk ) ,
819
+ ]
820
+ } ,
821
+ DotNetToolsJson = new ( )
822
+ {
823
+ FilePath = ".config/dotnet-tools.json" ,
824
+ Dependencies = [
825
+ new ( "microsoft.botsay" , "1.0.0" , DependencyType . DotNetTool ) ,
826
+ new ( "dotnetsay" , "2.1.3" , DependencyType . DotNetTool ) ,
827
+ ]
828
+ }
829
+ }
830
+ ) ;
831
+ }
832
+
712
833
[ Fact ]
713
834
public async Task TestRepo_SolutionFileCasingMismatchIsResolved ( )
714
835
{
0 commit comments