Ejemplo n.º 1
0
        /// <summary>
        /// Gets the assemblies that have been loaded into the execution context of application domain from the supplied type.
        /// </summary>
        /// <param name="type"></param>
        /// <returns>An array of assemblies in the application domain from the supplied type.</returns>
        public Assembly[] GetAssemblies(Type type)
        {
            List <Assembly> assemblies = new List <Assembly>();

            var dependencyModel = DependencyContext.Load(type.GetTypeInfo().Assembly);

            foreach (var assemblyName in dependencyModel.GetRuntimeAssemblyNames(RuntimeEnvironment.GetRuntimeIdentifier()))
            {
                try
                {
                    try
                    {
                        var assembly = Assembly.Load(assemblyName);

                        // just load all types and skip this assembly if one or more types cannot be resolved
                        assembly.DefinedTypes.ToArray();
                        assemblies.Add(assembly);
                    }
                    catch (Exception ex)
                    {
                        Debug.Write(ex.Message);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Write(ex.Message);
                }
            }

            return(assemblies.OrderBy(a => a.FullName).ToArray());
        }
Ejemplo n.º 2
0
        public static string GetCurrentRuntimeId()
        {
            if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
            {
                return(RuntimeEnvironment.GetRuntimeIdentifier());
            }
            var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();

            if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.1", StringComparison.Ordinal))
            {
                return("win7-" + arch);
            }
            if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.2", StringComparison.Ordinal))
            {
                return("win8-" + arch);
            }
            if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.3", StringComparison.Ordinal))
            {
                return("win81-" + arch);
            }
            if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("10.0", StringComparison.Ordinal))
            {
                return("win10-" + arch);
            }

            throw new InvalidOperationException("Runtime not supported");
        }
        static GivenThatWeWantToStoreAProjectWithDependencies()
        {
            var rid = RuntimeEnvironment.GetRuntimeIdentifier();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _runtimeOs    = "win7";
                _runtimeLibOs = "win";
                _testArch     = rid.Substring(rid.LastIndexOf("-") + 1);
                _runtimeRid   = "win7-" + _testArch;
            }
            else
            {
                _runtimeOs    = "unix";
                _runtimeLibOs = "unix";

                if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    // microsoft.netcore.coredistools only has assets for osx.10.10
                    _runtimeRid = "osx.10.10-x64";
                }
                else if (rid.Contains("ubuntu"))
                {
                    // microsoft.netcore.coredistools only has assets for ubuntu.14.04-x64
                    _runtimeRid = "ubuntu.14.04-x64";
                }
                else
                {
                    _runtimeRid = rid;
                }
            }
        }
Ejemplo n.º 4
0
        public override bool Execute()
        {
            Rid    = RuntimeEnvironment.GetRuntimeIdentifier();
            OSName = GetOSShortName();

            return(true);
        }
        static GivenThatWeWantToCacheAProjectWithDependencies()
        {
            var rid = RuntimeEnvironment.GetRuntimeIdentifier();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _runtimeOs    = "win7";
                _runtimeLibOs = "win";
                _testArch     = rid.Substring(rid.LastIndexOf("-") + 1);
                _runtimeRid   = "win7-" + _testArch;
            }
            else
            {
                _runtimeOs    = "unix";
                _runtimeLibOs = "unix";

                if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    // microsoft.netcore.dotnetapphost  has assets  only for osx.10.10
                    _runtimeRid = "osx.10.10-x64";
                }
                else
                {
                    _runtimeRid = rid;
                }
            }
        }
Ejemplo n.º 6
0
        public static BuildTargetResult Init(BuildTargetContext c)
        {
            var    configEnv   = Environment.GetEnvironmentVariable("CONFIGURATION");
            string platformEnv = Environment.GetEnvironmentVariable("TARGETPLATFORM") ?? RuntimeEnvironment.RuntimeArchitecture.ToString();
            string targetRID   = Environment.GetEnvironmentVariable("TARGETRID");

            if (targetRID == null)
            {
                targetRID = RuntimeEnvironment.GetRuntimeIdentifier();
                if (targetRID.StartsWith("win") && (targetRID.EndsWith("x86") || targetRID.EndsWith("x64")))
                {
                    targetRID = $"win7-{RuntimeEnvironment.RuntimeArchitecture}";
                }
            }
            string targetFramework = Environment.GetEnvironmentVariable("TARGETFRAMEWORK") ?? "netcoreapp1.0";

            if (string.IsNullOrEmpty(configEnv))
            {
                configEnv = "Debug";
            }

            c.BuildContext["Configuration"]   = configEnv;
            c.BuildContext["Channel"]         = Environment.GetEnvironmentVariable("CHANNEL");
            c.BuildContext["Platform"]        = platformEnv;
            c.BuildContext["TargetRID"]       = targetRID;
            c.BuildContext["TargetFramework"] = targetFramework;

            c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}");
            c.Info("Build Environment:");
            c.Info($" Operating System: {RuntimeEnvironment.OperatingSystem} {RuntimeEnvironment.OperatingSystemVersion}");
            c.Info($" Platform: " + platformEnv);

            return(c.Success());
        }
Ejemplo n.º 7
0
        private static IEnumerable <PlatformDependency> GetPlatformDependencies(DependencyContext pluginDependencyContext, IEnumerable <string> platformExtensions)
        {
            var dependencies    = new List <PlatformDependency>();
            var runtimeId       = RuntimeEnvironment.GetRuntimeIdentifier();
            var dependencyGraph = DependencyContext.Default.RuntimeGraph.FirstOrDefault(g => g.Runtime == runtimeId);
            // List of supported runtimes, includes the default runtime and the fallbacks for this dependency context
            var runtimes = new List <string> {
                dependencyGraph?.Runtime
            }.AddRangeToList <string>(dependencyGraph?.Fallbacks);

            foreach (var runtimeLibrary in pluginDependencyContext.RuntimeLibraries)
            {
                var assets = runtimeLibrary.NativeLibraryGroups.GetDefaultAssets();

                foreach (var runtime in runtimes)
                {
                    var runtimeSpecificGroup = runtimeLibrary.NativeLibraryGroups.FirstOrDefault(g => g.Runtime == runtime);
                    if (runtimeSpecificGroup != null)
                    {
                        assets = runtimeSpecificGroup.AssetPaths;
                        break;
                    }
                }
                foreach (var asset in assets.Where(a => platformExtensions.Contains(Path.GetExtension(a)))) // Only load assemblies and not debug files
                {
                    dependencies.Add(new PlatformDependency
                    {
                        DependencyNameWithoutExtension = Path.GetFileNameWithoutExtension(asset),
                        Version        = runtimeLibrary.Version,
                        DependencyPath = asset
                    });
                }
            }
            return(dependencies);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Attempts to locate a native asset with the given name in the default NuGet package cache folder.
        /// </summary>
        private Boolean TryLocateNativeAssetFromDeps(String name, out String depsResolvedPath)
        {
            depsResolvedPath = null;

            var defaultContext = DependencyContext.Default;

            if (defaultContext == null)
            {
                return(false);
            }

            var userHomeDirectory = UltravioletPlatformInfo.CurrentPlatform == UltravioletPlatform.Windows ?
                                    Environment.GetEnvironmentVariable("USERPROFILE") : Environment.GetEnvironmentVariable("HOME");
            var nugetPackagesRootDir = Path.Combine(userHomeDirectory, ".nuget", "packages");

            var runtimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier();

            foreach (var runtimeLib in defaultContext.RuntimeLibraries)
            {
                foreach (var nativeAsset in runtimeLib.GetRuntimeNativeAssets(defaultContext, runtimeIdentifier))
                {
                    if (Path.GetFileName(nativeAsset) == name || Path.GetFileNameWithoutExtension(nativeAsset) == name)
                    {
                        var fullPath = Path.Combine(nugetPackagesRootDir, runtimeLib.Name.ToLowerInvariant(), runtimeLib.Version, nativeAsset);
                        fullPath         = Path.GetFullPath(fullPath);
                        depsResolvedPath = fullPath;
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 9
0
        private void InitializeTelemetry()
        {
            try
            {
                _client = new TelemetryClient();
                _client.InstrumentationKey = InstrumentationKey;
                _client.Context.Session.Id = Guid.NewGuid().ToString();

                _client.Context.Device.OperatingSystem = RuntimeEnvironment.OperatingSystem;

                _commonProperties = new Dictionary <string, string>();
                _commonProperties.Add(OSVersion, RuntimeEnvironment.OperatingSystemVersion);
                _commonProperties.Add(OSPlatform, RuntimeEnvironment.OperatingSystemPlatform.ToString());
                _commonProperties.Add(RuntimeId, RuntimeEnvironment.GetRuntimeIdentifier());
                _commonProperties.Add(ProductVersion, Product.Version);
                _commonProperties.Add(TelemetryProfile, Environment.GetEnvironmentVariable(TelemetryProfileEnvironmentVariable));
                _commonMeasurements = new Dictionary <string, double>();
            }
            catch (Exception)
            {
                _client = null;
                // we dont want to fail the tool if telemetry fails.
                Debug.Fail("Exception during telemetry initialization");
            }
        }
Ejemplo n.º 10
0
        public override bool Execute()
        {
            Rid = RuntimeEnvironment.GetRuntimeIdentifier();

            switch (RuntimeEnvironment.OperatingSystemPlatform)
            {
            case Platform.Windows:
                OSName = "Windows_NT";
                break;

            case Platform.Linux:
                OSName = "Linux";
                break;

            case Platform.Darwin:
                OSName = "OSX";
                break;

            default:
                Log.LogError("Could not determine display name for platform.");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 11
0
        public static IEnumerable <AssemblyName> GetAssemblies()
        {
            var runtimeId  = RuntimeEnvironment.GetRuntimeIdentifier();
            var assemblies = DependencyContext.Default.GetRuntimeAssemblyNames(runtimeId);

            return(assemblies);
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            Console.WriteLine("Installed .Net versions are:");

            string        clipath = Path.GetDirectoryName(new Microsoft.DotNet.Cli.Utils.Muxer().MuxerPath);
            DirectoryInfo di      = new DirectoryInfo(Path.Combine(clipath, "sdk"));

            Console.WriteLine("Active version: " + Microsoft.DotNet.Cli.Utils.Product.Version);
            Console.WriteLine();

            foreach (var item in di.GetDirectories())
            {
                string versionfile = Path.Combine(item.FullName, ".version");
                if (IsVersionFilePresent(versionfile))
                {
                    string version = item.Name;
                    string hash    = GetHash(versionfile);

                    string template = $@"Product Information:
 Version:            {version}
 Commit SHA-1 hash:  {hash}
";
                    Console.WriteLine(template);
                }
            }
            Console.WriteLine($@"Runtime Environment:
 OS Name:     {RuntimeEnvironment.OperatingSystem}
 OS Version:  {RuntimeEnvironment.OperatingSystemVersion}
 OS Platform: {RuntimeEnvironment.OperatingSystemPlatform}
 RID:         {RuntimeEnvironment.GetRuntimeIdentifier()}");
        }
Ejemplo n.º 13
0
        private void Restore(string pathToProjectFile)
        {
            var runtimeId = RuntimeEnvironment.GetRuntimeIdentifier();

            _commandRunner.Execute("dotnet", $"restore {pathToProjectFile} -r {runtimeId}");
            //_commandRunner.Execute("DotNet", $"restore {pathToProjectFile}");
        }
Ejemplo n.º 14
0
        private string GetCoreCLRRid()
        {
            string rid = null;

            if (CurrentPlatform.IsWindows)
            {
                var arch = RuntimeEnvironment.RuntimeArchitecture;
                rid = $"win7-{arch}";
            }
            else if (CurrentPlatform.IsOSX)
            {
                rid = "osx.10.10-x64";
            }
            else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL)
            {
                // CentOS runtime is in the runtime.rhel.7-x64... package as are all
                // versions of RHEL
                rid = "rhel.7-x64";
            }
            else if (CurrentPlatform.IsLinux)
            {
                rid = RuntimeEnvironment.GetRuntimeIdentifier();
            }

            return(rid);
        }
Ejemplo n.º 15
0
        public static List <Assembly> GetRuntimeAssemblies()
        {
            var runtimeId     = RuntimeEnvironment.GetRuntimeIdentifier();
            var assemblyNames = DependencyContext.Default.GetRuntimeAssemblyNames(runtimeId);

            return(assemblyNames.Select(Assembly.Load).ToList());
        }
Ejemplo n.º 16
0
        public static string GetBadgeMoniker()
        {
            string rid = Environment.GetEnvironmentVariable("TARGETRID") ?? RuntimeEnvironment.GetRuntimeIdentifier();

            if (rid.StartsWith("linux-"))
            {
                return($"Linux_{Environment.GetEnvironmentVariable("TARGETPLATFORM") ?? CurrentArchitecture.Current.ToString()}");
            }

            switch (RuntimeEnvironment.GetRuntimeIdentifier())
            {
            case "ubuntu.16.04-x64":
                return("Ubuntu_16_04_x64");

            case "ubuntu.16.10-x64":
                return("Ubuntu_16_10_x64");

            case "fedora.23-x64":
                return("Fedora_23_x64");

            case "fedora.24-x64":
                return("Fedora_24_x64");

            case "opensuse.13.2-x64":
                return("openSUSE_13_2_x64");

            case "opensuse.42.1-x64":
                return("openSUSE_42_1_x64");
            }

            return($"{CurrentPlatform.Current}_{Environment.GetEnvironmentVariable("TARGETPLATFORM") ?? CurrentArchitecture.Current.ToString()}");
        }
        public void It_does_not_fail_publishing_a_self_twice()
        {
            var runtimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier();

            var testAsset = _testAssetsManager
                            .CopyTestAsset(TestProjectName)
                            .WithSource();

            var msbuildArgs = new string[] { "/p:SelfContained=true",
                                             $"/p:TargetFramework={TargetFramework}",
                                             $"/p:RuntimeIdentifier={runtimeIdentifier}" };

            var restoreCommand = new RestoreCommand(Log, testAsset.TestRoot);

            restoreCommand.Execute(msbuildArgs);

            var publishCommand = new PublishCommand(Log, testAsset.TestRoot);

            publishCommand
            .Execute(msbuildArgs)
            .Should().Pass();

            publishCommand
            .Execute(msbuildArgs)
            .Should().Pass().And.NotHaveStdOutContaining("HelloWorld.exe' already exists");
        }
Ejemplo n.º 18
0
        protected virtual void Init()
        {
            // By default we include the assemblies containing the
            // principles a part of the built-ins and every other
            // assembly in context a part of the search scope
            AddBuiltIns(typeof(TProv).GetTypeInfo().Assembly, typeof(TProd).GetTypeInfo().Assembly);

            // Get a list of all assemblies used at runtime
            string runtimeId = RuntimeEnvironment.GetRuntimeIdentifier();
            IEnumerable <AssemblyName> assemblies = DependencyContext.Default.GetRuntimeAssemblyNames(runtimeId);
            List <AssemblyName>        asms       = new List <AssemblyName>();

            foreach (AssemblyName assembly in assemblies)
            {
                // Check if the assembly has already been processed
                // If it has already been processed it will be skipped
                if (asms.Contains(assembly))
                {
                    continue;
                }

                // Add assemblies to the temporary list
                // This prevents duplicate addition load
                asms.Add(assembly);

                // The assembly has not been added before
                // Add it to the assemblies to load
                AddSearchAssemblies(Assembly.Load(assembly));
            }
        }
Ejemplo n.º 19
0
        public Assembly[] GetAssemblies()
        {
            var rid = RuntimeEnvironment.GetRuntimeIdentifier();
            var ass = DependencyContext.Default.GetRuntimeAssemblyNames(rid);

            return(ass.Select(xan => Assembly.Load(xan)).ToArray());
        }
Ejemplo n.º 20
0
        /// <summary>
        ///   This is the context from which tests will be run in the
        ///   linker repo. The local directory that contains the
        ///   linker integration packages (hard-coded here) is
        ///   searched for the tasks package. This assumes that only
        ///   one version of the package is present, and uses it to
        ///   unambiguously determine which pacakge to use in the tests.
        /// </summary>
        public static TestContext CreateDefaultContext()
        {
            var packageName = "ILLink.Tasks";
            // test is run from corebuild/testbin/<config>/<tfm>
            var corebuild     = "../../../";
            var testBin       = Path.Combine(corebuild, "testbin");
            var packageSource = Path.Combine(corebuild, "integration", "bin", "nupkgs");
            var tasksPackages = Directory.GetFiles(packageSource)
                                .Where(p => Path.GetExtension(p) == ".nupkg")
                                .Select(p => Path.GetFileNameWithoutExtension(p))
                                .Where(p => p.StartsWith(packageName));
            var nPackages = tasksPackages.Count();

            if (nPackages > 1)
            {
                throw new Exception($"duplicate {packageName} packages in {packageSource}");
            }
            else if (nPackages == 0)
            {
                throw new Exception($"{packageName} package not found in {packageSource}");
            }
            var tasksPackage    = tasksPackages.Single();
            var version         = tasksPackage.Remove(0, packageName.Length + 1);
            var dotnetDir       = Path.Combine(corebuild, "Tools", "dotnetcli");
            var dotnetToolNames = Directory.GetFiles(dotnetDir)
                                  .Select(p => Path.GetFileName(p))
                                  .Where(p => p.Contains("dotnet"));
            var nTools = dotnetToolNames.Count();

            if (nTools > 1)
            {
                throw new Exception($"multiple dotnet tools in {dotnetDir}");
            }
            else if (nTools == 0)
            {
                throw new Exception($"no dotnet tool found in {dotnetDir}");
            }
            var dotnetToolName = dotnetToolNames.Single();
            var dotnetToolPath = Path.Combine(dotnetDir, dotnetToolName);

            var context = new TestContext();

            context.PackageSource       = packageSource;
            context.TasksPackageName    = packageName;
            context.TasksPackageVersion = version;
            context.DotnetToolPath      = dotnetToolPath;
            // This sets the RID to the RID of the currently-executing system.
            context.RuntimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier();
            // workaround: the osx.10.13-x64 RID doesn't exist yet.
            // see https://github.com/dotnet/core-setup/issues/3301
            if (context.RuntimeIdentifier == "osx.10.13-x64")
            {
                context.RuntimeIdentifier = "osx.10.12-x64";
            }
            // We want to build and link integration projects in the
            // release configuration.
            context.Configuration = "Release";
            context.TestBin       = testBin;
            return(context);
        }
        public void ItPublishesARunnableSelfContainedApp()
        {
            var testAppName  = "MSBuildTestApp";
            var testInstance = TestAssetsManager
                               .CreateTestInstance(testAppName);

            var testProjectDirectory = testInstance.TestRoot;
            var rid = RuntimeEnvironment.GetRuntimeIdentifier();

            new Publish3Command()
            .WithFramework("netcoreapp1.0")
            .WithRuntime(rid)
            .WithWorkingDirectory(testProjectDirectory)
            .Execute()
            .Should()
            .Pass();

            var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
            var outputProgram = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", rid, "publish", $"{testAppName}{Constants.ExeSuffix}");

            new TestCommand(outputProgram)
            .ExecuteWithCapturedOutput()
            .Should()
            .Pass()
            .And
            .HaveStdOutContaining("Hello World");
        }
        private void PublishAppWithLibraryAndRid(bool selfContained, out DirectoryInfo publishDirectory, out string runtimeIdentifier)
        {
            runtimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier();
            var testAsset = _testAssetsManager
                            .CopyTestAsset("AppWithLibraryAndRid", $"PublishAppWithLibraryAndRid{selfContained}")
                            .WithSource();

            var projectPath = Path.Combine(testAsset.TestRoot, "App");

            var msbuildArgs = new[]
            {
                $"/p:RuntimeIdentifier={runtimeIdentifier}",
                $"/p:TestRuntimeIdentifier={runtimeIdentifier}",
                $"/p:SelfContained={selfContained}"
            };

            var restoreCommand = new RestoreCommand(Log, projectPath, "App.csproj");

            restoreCommand
            .Execute(msbuildArgs)
            .Should()
            .Pass();

            var publishCommand = new PublishCommand(Log, projectPath);

            publishCommand
            .Execute(msbuildArgs)
            .Should().Pass();

            publishDirectory = publishCommand.GetOutputDirectory("netcoreapp1.1", runtimeIdentifier: runtimeIdentifier);
        }
        public void It_builds_a_framework_dependent_RID_specific_runnable_output()
        {
            var runtimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier();
            var testAsset         = _testAssetsManager
                                    .CopyTestAsset("AppWithLibraryAndRid", "BuildFrameworkDependentRIDSpecific")
                                    .WithSource();

            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX))
            {
                //  .NET Core 2.1.0 packages don't support latest versions of OS X, so roll forward to the
                //  latest patch which does
                testAsset = testAsset.WithProjectChanges(project =>
                {
                    var ns = project.Root.Name.Namespace;

                    var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First();
                    propertyGroup.Add(new XElement("TargetLatestRuntimePatch", true));
                });
            }

            var projectPath = Path.Combine(testAsset.TestRoot, "App");

            var restoreCommand = new RestoreCommand(Log, projectPath, "App.csproj");

            restoreCommand
            .Execute($"/p:TestRuntimeIdentifier={runtimeIdentifier}")
            .Should()
            .Pass();

            var buildCommand = new BuildCommand(Log, projectPath);

            buildCommand
            .Execute($"/p:RuntimeIdentifier={runtimeIdentifier}", $"/p:TestRuntimeIdentifier={runtimeIdentifier}", "/p:SelfContained=false")
            .Should().Pass();

            var outputDirectory = buildCommand.GetOutputDirectory("netcoreapp2.1", runtimeIdentifier: runtimeIdentifier);

            outputDirectory.Should().NotHaveSubDirectories();
            outputDirectory.Should().OnlyHaveFiles(new[] {
                $"App{Constants.ExeSuffix}",
                "App.dll",
                "App.pdb",
                "App.deps.json",
                "App.runtimeconfig.json",
                "App.runtimeconfig.dev.json",
                "LibraryWithoutRid.dll",
                "LibraryWithoutRid.pdb",
                "LibraryWithRid.dll",
                "LibraryWithRid.pdb",
                "LibraryWithRids.dll",
                "LibraryWithRids.pdb",
            });

            Command.Create(TestContext.Current.ToolsetUnderTest.DotNetHostPath, new[] { Path.Combine(outputDirectory.FullName, "App.dll") })
            .CaptureStdOut()
            .Execute()
            .Should().Pass()
            .And.HaveStdOutContaining($"3.13.0 '{runtimeIdentifier}' 3.13.0 '{runtimeIdentifier}' Hello World");
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Reads the version file and adds runtime specific information
        /// </summary>
        public static string ReadAndInterpretVersionFile()
        {
            var content = File.ReadAllText(DotnetFiles.VersionFile);

            content += Environment.NewLine;
            content += RuntimeEnvironment.GetRuntimeIdentifier();
            return(content);
        }
        private static string GetOptimizationRootPath(string version)
        {
            var rid = RuntimeEnvironment.GetRuntimeIdentifier();

            return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
                ? $@"Microsoft\dotnet\optimizationdata\{version}\{rid}"
                : $@".dotnet/optimizationdata/{version}/{rid}");
        }
Ejemplo n.º 26
0
        public override bool Execute()
        {
            Rid          = RuntimeEnvironment.GetRuntimeIdentifier();
            Architecture = RuntimeEnvironment.RuntimeArchitecture;
            OSName       = Monikers.GetOSShortName();

            return(true);
        }
Ejemplo n.º 27
0
        public override bool Execute()
        {
            Rid        = RuntimeEnvironment.GetRuntimeIdentifier();
            OSName     = GetOSShortName();
            OSPlatform = RuntimeEnvironment.OperatingSystemPlatform.ToString().ToLower();

            return(true);
        }
Ejemplo n.º 28
0
        public override bool Execute()
        {
            Rid          = string.IsNullOrEmpty(OverrideRid) ? RuntimeEnvironment.GetRuntimeIdentifier() : OverrideRid;
            Architecture = RuntimeEnvironment.RuntimeArchitecture;
            OSName       = Monikers.GetOSShortName();

            return(true);
        }
Ejemplo n.º 29
0
 void DisplayRuntimeEnvironment()
 {
     ColorConsole.WriteLine(ColorStyle.SectionHeader, "Runtime Environment");
     ColorConsole.WriteLabelLine("    OS Platform: ", RuntimeEnvironment.OperatingSystemPlatform);
     ColorConsole.WriteLabelLine("     OS Version: ", RuntimeEnvironment.OperatingSystemVersion);
     ColorConsole.WriteLabelLine("        Runtime: ", RuntimeEnvironment.GetRuntimeIdentifier());
     ColorConsole.WriteLine();
 }
Ejemplo n.º 30
0
        public DefaultAssemblyProvider()
        {
            var entryAssembly   = Assembly.GetEntryAssembly();
            var dependencyModel = DependencyContext.Load(entryAssembly);
            var assemblyNames   = dependencyModel.GetRuntimeAssemblyNames(RuntimeEnvironment.GetRuntimeIdentifier());

            AvailableAssemblies = assemblyNames.Select(asm => new AssemblyInfo(asm.Name, string.Empty));
        }