Пример #1
0
        private static string FindRuntimeHome()
        {
            var runtimeHome   = Environment.GetEnvironmentVariable(EnvironmentNames.Home);
            var pathSeparator = Path.PathSeparator;

            if (string.IsNullOrEmpty(runtimeHome))
            {
                var runtimeGlobalPath = DnuEnvironment.GetFolderPath(DnuFolderPath.DnxGlobalPath);
                var userRuntimeFolder = DnuEnvironment.GetFolderPath(DnuFolderPath.DefaultDnxHome);

                runtimeHome = $"{userRuntimeFolder}{pathSeparator}{runtimeGlobalPath}";
            }

            foreach (var probePath in runtimeHome.Split(new[] { pathSeparator }, StringSplitOptions.RemoveEmptyEntries))
            {
                string fullPath = Environment.ExpandEnvironmentVariables(probePath);

                if (Directory.Exists(fullPath))
                {
                    return(fullPath);
                }
            }

            return(null);
        }
Пример #2
0
        private bool WrapCsProject()
        {
            if (string.IsNullOrEmpty(Configuration))
            {
                Configuration = "debug";
            }

            MsBuildPath = string.IsNullOrEmpty(MsBuildPath) ?
                          DnuEnvironment.GetFolderPath(DnuFolderPath.DefaultMsBuildPath) : MsBuildPath;

            XDocument resolutionResults;
            string    errorMessage;

            if (!TryResolveReferences(out resolutionResults, out errorMessage))
            {
                Reports.Error.WriteLine(errorMessage);
                return(false);
            }

            foreach (var projectElement in resolutionResults.Root.Elements())
            {
                EmitProjectWrapper(projectElement);
            }

            return(true);
        }
Пример #3
0
 public static void Register(CommandLineApplication cmdApp, ReportsFactory reportsFactory)
 {
     cmdApp.Command("clear-http-cache", c =>
     {
         c.Description = "Clears the package cache.";
         c.HelpOption("-?|-h|--help");
         c.OnExecute(() =>
         {
             var command = new ClearCacheCommand(
                 reportsFactory.CreateReports(quiet: false),
                 DnuEnvironment.GetFolderPath(DnuFolderPath.HttpCacheDirectory));
             return(command.Execute());
         });
     });
 }