Ejemplo n.º 1
0
        public static BuildTargetResult RestoreLockedCoreHost(BuildTargetContext c)
        {
            var hostVersion          = c.BuildContext.Get <HostVersion>("HostVersion");
            var lockedHostFxrVersion = hostVersion.LockedHostFxrVersion;

            var currentRid = HostPackagePlatformRid;

            string projectJson     = $@"{{
  ""dependencies"": {{
      ""Microsoft.NETCore.DotNetHostResolver"" : ""{lockedHostFxrVersion}""
  }},
  ""frameworks"": {{
      ""netcoreapp1.0"": {{}}
  }},
  ""runtimes"": {{
      ""{currentRid}"": {{}}
  }}
}}";
            var    tempPjDirectory = Path.Combine(Dirs.Intermediate, "lockedHostTemp");

            FS.Rmdir(tempPjDirectory);
            Directory.CreateDirectory(tempPjDirectory);
            var tempPjFile = Path.Combine(tempPjDirectory, "project.json");

            File.WriteAllText(tempPjFile, projectJson);

            DotNetCli.Stage0.Restore("--verbosity", "verbose",
                                     "--fallbacksource", Dirs.CorehostLocalPackages,
                                     "--fallbacksource", Dirs.CorehostDummyPackages)
            .WorkingDirectory(tempPjDirectory)
            .Execute()
            .EnsureSuccessful();

            // Clean out before publishing locked binaries
            FS.Rmdir(Dirs.CorehostLocked);

            // Use specific RIDS for non-backward compatible platforms.
            (CurrentPlatform.IsWindows
                ? DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build")
                : DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build", "-r", currentRid))
            .WorkingDirectory(tempPjDirectory)
            .Execute()
            .EnsureSuccessful();

            return(c.Success());
        }
Ejemplo n.º 2
0
        private void CreateAndRestoreToolConsumingProject()
        {
            if (Directory.Exists(_consumingProjectDirectory))
            {
                FS.Rmdir(_consumingProjectDirectory);
            }
            FS.Mkdirp(_consumingProjectDirectory);

            var projectJsonFile = Path.Combine(_consumingProjectDirectory, "project.json");

            File.WriteAllText(projectJsonFile, GetDotnetDebProjectJsonContents());

            Command restore = _dotnetDebToolPackageSource == null
                ? _dotnet.Restore()
                : _dotnet.Restore("-f", $"{_dotnetDebToolPackageSource}");

            restore
            .WorkingDirectory(Path.GetDirectoryName(projectJsonFile))
            .Execute()
            .EnsureSuccessful();
        }