Exemplo n.º 1
0
        public void Hostfxr_resolve_sdk2_without_global_json_or_flags()
        {
            // with no global.json and no flags, pick latest SDK

            var f = new SdkResolutionFixture(sharedTestState);

            string expectedData = string.Join(';', new[]
Exemplo n.º 2
0
        public void Hostfxr_get_available_sdks_with_multilevel_lookup()
        {
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                // multilevel lookup is not supported on non-Windows
                return;
            }

            var f = new SdkResolutionFixture(sharedTestState);

            // With multi-level lookup (windows onnly): get local and global sdks sorted by ascending version,
            // with global sdk coming before local sdk when versions are equal
            string expectedList = string.Join(';', new[]
            {
                Path.Combine(f.LocalSdkDir, "0.1.2"),
                Path.Combine(f.ProgramFilesGlobalSdkDir, "1.2.3"),
                Path.Combine(f.LocalSdkDir, "1.2.3"),
                Path.Combine(f.ProgramFilesGlobalSdkDir, "2.3.4-preview"),
                Path.Combine(f.SelfRegisteredGlobalSdkDir, "3.0.0"),
                Path.Combine(f.ProgramFilesGlobalSdkDir, "4.5.6"),
                Path.Combine(f.LocalSdkDir, "5.6.7-preview"),
                Path.Combine(f.SelfRegisteredGlobalSdkDir, "5.6.7"),
                Path.Combine(f.SelfRegisteredGlobalSdkDir, "15.1.4-preview"),
            });

            f.Dotnet.Exec(f.AppDll, new[] { "hostfxr_get_available_sdks", f.ExeDir })
            .EnvironmentVariable("TEST_MULTILEVEL_LOOKUP_PROGRAM_FILES", f.ProgramFiles)
            .EnvironmentVariable("TEST_MULTILEVEL_LOOKUP_SELF_REGISTERED", f.SelfRegistered)
            .CaptureStdOut()
            .CaptureStdErr()
            .Execute()
            .Should().Pass()
            .And.HaveStdOutContaining("hostfxr_get_available_sdks:Success")
            .And.HaveStdOutContaining($"hostfxr_get_available_sdks sdks:[{expectedList}]");
        }
Exemplo n.º 3
0
        public void Hostfxr_get_available_sdks_without_multilevel_lookup()
        {
            // Without multi-level lookup: get only sdks sorted by ascending version

            var f = new SdkResolutionFixture(sharedTestState);

            string expectedList = string.Join(';', new[]
            {
                Path.Combine(f.LocalSdkDir, "0.1.2"),
                Path.Combine(f.LocalSdkDir, "1.2.3"),
                Path.Combine(f.LocalSdkDir, "5.6.7-preview"),
            });

            f.Dotnet.Exec(f.AppDll, new[] { "hostfxr_get_available_sdks", f.ExeDir })
            .CaptureStdOut()
            .CaptureStdErr()
            .Execute()
            .Should().Pass()
            .And.HaveStdOutContaining("hostfxr_get_available_sdks:Success")
            .And.HaveStdOutContaining($"hostfxr_get_available_sdks sdks:[{expectedList}]");
        }