当前位置: 首页>>代码示例>>C#>>正文


C# IEnvironment.GetEnvironmentVariable方法代码示例

本文整理汇总了C#中IEnvironment.GetEnvironmentVariable方法的典型用法代码示例。如果您正苦于以下问题:C# IEnvironment.GetEnvironmentVariable方法的具体用法?C# IEnvironment.GetEnvironmentVariable怎么用?C# IEnvironment.GetEnvironmentVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnvironment的用法示例。


在下文中一共展示了IEnvironment.GetEnvironmentVariable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppVeyor

 public AppVeyor(Logger logger, IEnvironment environment, IHttpClientFactory httpClientFactory)
 {
     _logger = logger;
     _environment = environment;
     _httpClientFactory = httpClientFactory;
     _appVeyorApiUrl = _environment.GetEnvironmentVariable("APPVEYOR_API_URL");
 }
开发者ID:roh85,项目名称:vika,代码行数:7,代码来源:AppVeyor.cs

示例2: Resolve

 internal static string Resolve(IEnvironment envirnment, IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment)
 {
     var path = envirnment.GetEnvironmentVariable(DotNetReferenceAssembliesPathEnv);
     if (!string.IsNullOrEmpty(path))
     {
         return path;
     }
     
     return GetDefaultDotNetReferenceAssembliesPath(fileSystem, runtimeEnvironment);
 }
开发者ID:krytarowski,项目名称:cli,代码行数:10,代码来源:DotNetReferenceAssembliesPathResolver.cs

示例3: GetDefaultPackageDirectory

        internal static string GetDefaultPackageDirectory(IRuntimeEnvironment runtimeEnvironment, IEnvironment environment)
        {
            var packageDirectory = environment.GetEnvironmentVariable("NUGET_PACKAGES");

            if (!string.IsNullOrEmpty(packageDirectory))
            {
                return packageDirectory;
            }

            string basePath;
            if (runtimeEnvironment.OperatingSystemPlatform == Platform.Windows)
            {
                basePath = environment.GetEnvironmentVariable("USERPROFILE");
            }
            else
            {
                basePath = environment.GetEnvironmentVariable("HOME");
            }
            if (string.IsNullOrEmpty(basePath))
            {
                return null;
            }
            return Path.Combine(basePath, ".nuget", "packages");
        }
开发者ID:ericstj,项目名称:cli,代码行数:24,代码来源:PackageCompilationAssemblyResolver.cs

示例4: GetFallbackSearchPaths

        internal static string[] GetFallbackSearchPaths(IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment, IEnvironment environment)
        {
            if (runtimeEnvironment.OperatingSystemPlatform != Platform.Windows)
            {
                return new string[0];
            }

            var net20Dir = Path.Combine(environment.GetEnvironmentVariable("WINDIR"), "Microsoft.NET", "Framework", "v2.0.50727");

            if (!fileSystem.Directory.Exists(net20Dir))
            {
                return new string[0];
            }
            return new[] { net20Dir };
        }
开发者ID:noahfalk,项目名称:cli,代码行数:15,代码来源:ReferenceAssemblyPathResolver.cs

示例5: GetDefaultReferenceAssembliesPath

        internal static string GetDefaultReferenceAssembliesPath(IRuntimeEnvironment runtimeEnvironment, IEnvironment environment)
        {
            // Allow setting the reference assemblies path via an environment variable
            var referenceAssembliesPath = environment.GetEnvironmentVariable("DOTNET_REFERENCE_ASSEMBLIES_PATH");

            if (!string.IsNullOrEmpty(referenceAssembliesPath))
            {
                return referenceAssembliesPath;
            }

            if (runtimeEnvironment.OperatingSystemPlatform != Platform.Windows)
            {
                // There is no reference assemblies path outside of windows
                // The environment variable can be used to specify one
                return null;
            }

            // References assemblies are in %ProgramFiles(x86)% on
            // 64 bit machines
            var programFiles = environment.GetEnvironmentVariable("ProgramFiles(x86)");

            if (string.IsNullOrEmpty(programFiles))
            {
                // On 32 bit machines they are in %ProgramFiles%
                programFiles = environment.GetEnvironmentVariable("ProgramFiles");
            }

            if (string.IsNullOrEmpty(programFiles))
            {
                // Reference assemblies aren't installed
                return null;
            }

            return Path.Combine(
                programFiles,
                "Reference Assemblies", "Microsoft", "Framework");
        }
开发者ID:noahfalk,项目名称:cli,代码行数:37,代码来源:ReferenceAssemblyPathResolver.cs

示例6: GetDefaultReferenceAssembliesPath

        internal static string GetDefaultReferenceAssembliesPath(IFileSystem fileSystem, Platform platform, IEnvironment environment)
        {
            // Allow setting the reference assemblies path via an environment variable
            var referenceAssembliesPath = DotNetReferenceAssembliesPathResolver.Resolve(environment, fileSystem); 
            if (!string.IsNullOrEmpty(referenceAssembliesPath))
            {
                return referenceAssembliesPath;
            }

            if (platform != Platform.Windows)
            {
                // There is no reference assemblies path outside of windows
                // The environment variable can be used to specify one
                return null;
            }

            // References assemblies are in %ProgramFiles(x86)% on
            // 64 bit machines
            var programFiles = environment.GetEnvironmentVariable("ProgramFiles(x86)");

            if (string.IsNullOrEmpty(programFiles))
            {
                // On 32 bit machines they are in %ProgramFiles%
                programFiles = environment.GetEnvironmentVariable("ProgramFiles");
            }

            if (string.IsNullOrEmpty(programFiles))
            {
                // Reference assemblies aren't installed
                return null;
            }

            return Path.Combine(
                programFiles,
                "Reference Assemblies", "Microsoft", "Framework");
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:36,代码来源:ReferenceAssemblyPathResolver.cs

示例7: GetDefaultPackageCacheDirectory

 internal static string GetDefaultPackageCacheDirectory(IEnvironment environment)
 {
     return environment.GetEnvironmentVariable("DOTNET_PACKAGES_CACHE");
 }
开发者ID:noahfalk,项目名称:cli,代码行数:4,代码来源:PackageCacheCompilationAssemblyResolver.cs


注:本文中的IEnvironment.GetEnvironmentVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。