/// <param name="publishDirName"> /// The directory inside of <see cref="MeditationLogContext.DevopsDistributionPath"/> /// to place the published project. /// Set to null to have it be <paramref name="rid"/>. /// </param> public void DevopsPublish(string rid, string?publishDirName = null) { const string configuration = "Release"; var publishDir = context.DevopsDistributionPath.Combine(publishDirName ?? rid); context.EnsureDirectoryExists(publishDir); context.CleanDirectory(publishDir); var publishSettings = new DotNetCorePublishSettings { Configuration = configuration, OutputDirectory = publishDir, MSBuildSettings = MsBuildHelpers.GetMsBuildSettings(configuration), // We'll be running in a docker image with the runtime, no need // to include the entire runtime. SelfContained = false, Runtime = rid }; context.DotNetCorePublish( context.DevopsCsProj.ToString(), publishSettings ); }
public override void Run(DotNetCoreContext context) { var publishedProjects = new List <Project>(); foreach (var project in context.Projects.Where(x => x.ProjectParserResult.IsNetCore && x.ProjectParserResult.NetCore.TargetFrameworks.Any(f => f.StartsWith("netcoreapp")))) { context.Information("Publishing project {0} with version: {1}", project.ProjectParserResult.NetCore.PackageId, context.BuildVersion.Version.FullSemVer); project.PublishedOutputDirectory = context.Artifacts.Combine(project.ProjectParserResult.NetCore.PackageId); var settings = new DotNetCorePublishSettings { Configuration = context.Configuration, OutputDirectory = project.PublishedOutputDirectory }; var runtimeIdentifiers = project.ProjectParserResult.NetCore.RuntimeIdentifiers; if (runtimeIdentifiers != null && runtimeIdentifiers.Any()) { foreach (var runtime in runtimeIdentifiers) { settings.Runtime = runtime; context.DotNetCorePublish(project.ProjectPath.FullPath, settings); } } else { context.DotNetCorePublish(project.ProjectPath.FullPath, settings); } publishedProjects.Add(project); } context.Outputs.PublishedProjects = publishedProjects; }
/// <summary> /// Initializes a new instance of <see cref="DotNetCoreRestorePublishSettings"/> /// </summary> /// <param name="restoreSettings"></param> /// <param name="publishSettings"></param> public DotNetCoreRestorePublishSettings( DotNetCoreRestoreSettings restoreSettings, DotNetCorePublishSettings publishSettings) { RestoreSettings = restoreSettings ?? throw new ArgumentNullException(nameof(restoreSettings)); PublishSettings = publishSettings ?? throw new ArgumentNullException(nameof(publishSettings)); }
private static void DotNetCorePublish(ICakeContext context, string projectFile, string publishFolder, string buildConfiguration) { var settings = new DotNetCorePublishSettings { OutputDirectory = publishFolder, Configuration = buildConfiguration }; context.DotNetCorePublish(projectFile, settings); }
public static void PublishMultipleTasks(ICakeContext context, string jsonPath) { try { if (!string.IsNullOrEmpty(jsonPath)) { ProcessPath lstprocessPath = JsonConvert.DeserializeObject <ProcessPath>(jsonPath); if (lstprocessPath != null) { foreach (var path in lstprocessPath.lstPaths) { context.DeleteFiles(path.Deletepath); string publishDirectory = path.PublishPath; var publishSettings = new DotNetCorePublishSettings { Configuration = "Release", OutputDirectory = publishDirectory, Runtime = "win-x64" }; context.DotNetCorePublish(path.CSprojPath, publishSettings); var nuGetPackSettings = new NuGetPackSettings { OutputDirectory = "./publishpackage/", Version = BuildNumber }; context.NuGetPack(path.nuspecPath, nuGetPackSettings); } } } } catch (Exception ex) { } }
public static void DotNetCorePublish(this ICakeContext context, string project, DotNetCorePublishSettings settings) { if (context == null) { throw new ArgumentNullException("context"); } if (settings == null) { settings = new DotNetCorePublishSettings(); } var publisher = new DotNetCorePublisher(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); publisher.Publish(project, settings); }
private void ExecutePublish(IConfiguration configuration) { string projectPath = configuration.GetProjectPath(); configuration.FileExistsOrThrow(projectPath); configuration.RunOnConfiguredTargetFramework(framework => { DotNetCorePublishSettings settings = new DotNetCorePublishSettings { OutputDirectory = ArtifactsPath(configuration, framework), Framework = framework }; configuration.ApplyBuildParameters(projectPath, settings); configuration.Context.CakeContext.DotNetCorePublish(projectPath, settings); }); }
private static DirectoryPath PackPrepareNative(BuildContext context, string runtime) { var platform = context.Environment.Platform.Family; var outputPath = Paths.Native.Combine(platform.ToString().ToLower()).Combine(runtime); var settings = new DotNetCorePublishSettings { Framework = Constants.NetVersion60, Runtime = runtime, NoRestore = false, Configuration = context.MsBuildConfiguration, OutputDirectory = outputPath, MSBuildSettings = context.MsBuildSettings, ArgumentCustomization = arg => arg.Append("/p:PublishSingleFile=true --self-contained"), }; context.DotNetCorePublish("./src/GitVersion.App/GitVersion.App.csproj", settings); return(outputPath); }
// ----------------- Functions ----------------- public override void Run(MeditationLogContext context) { const string configuration = "Release"; var publishDir = context.DockerPath.Combine("bin"); context.EnsureDirectoryExists(publishDir); context.CleanDirectory(publishDir); var publishSettings = new DotNetCorePublishSettings { Configuration = configuration, OutputDirectory = publishDir, MSBuildSettings = MsBuildHelpers.GetMsBuildSettings(configuration), }; context.DotNetCorePublish( context.GuiCsProject.ToString(), publishSettings ); // No need to inclue these files in the docker image, // may as well decrease the file size a bit. var filesToDelete = new FilePath[] { publishDir.CombineWithFilePath("Meditu.Gui.exe"), publishDir.CombineWithFilePath("Meditu.Gui") }; foreach (FilePath path in filesToDelete) { if (context.FileExists(path)) { context.DeleteFile(path); } } }
public static void ApplyBuildParameters(this IConfiguration configuration, string projectOrSolutionFile, DotNetCorePublishSettings settings) { configuration.ApplyBuildParametersForDotNetCore(projectOrSolutionFile, buildConfiguration => settings.Configuration = buildConfiguration, () => settings.MSBuildSettings, msBuildSettings => settings.MSBuildSettings = msBuildSettings); }
public void Publish(string projectPath, DotNetCorePublishSettings settings) { AeroContext.DotNetCorePublish(projectPath, settings); }