diff --git a/scripts/dotnet-cli-build/MsiTargets.cs b/scripts/dotnet-cli-build/MsiTargets.cs index 12c3f1f6c..e0e3ecb37 100644 --- a/scripts/dotnet-cli-build/MsiTargets.cs +++ b/scripts/dotnet-cli-build/MsiTargets.cs @@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(SharedFrameworkTargets.PublishSharedHost))] + [Target] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c) { @@ -124,7 +124,7 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(SharedFrameworkTargets.PublishSharedFramework))] + [Target] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c) { diff --git a/scripts/dotnet-cli-build/PackageTargets.cs b/scripts/dotnet-cli-build/PackageTargets.cs index af31bf688..af17fe7b7 100644 --- a/scripts/dotnet-cli-build/PackageTargets.cs +++ b/scripts/dotnet-cli-build/PackageTargets.cs @@ -22,6 +22,8 @@ namespace Microsoft.DotNet.Cli.Build [Target(nameof(PrepareTargets.Init), nameof(PackageTargets.InitPackage), nameof(PackageTargets.GenerateVersionBadge), + nameof(SharedFrameworkTargets.PublishSharedHost), + nameof(SharedFrameworkTargets.PublishSharedFramework), nameof(PackageTargets.GenerateCompressedFile), nameof(InstallerTargets.GenerateInstaller), nameof(PackageTargets.GenerateNugetPackages))] @@ -55,14 +57,10 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateZip(BuildTargetContext c) { - var zipFile = c.BuildContext.Get("SdkCompressedFile"); + CreateZipFromDirectory(c.BuildContext.Get("SharedHostPublishRoot"), c.BuildContext.Get("SharedHostCompressedFile")); + CreateZipFromDirectory(c.BuildContext.Get("SharedFrameworkPublishRoot"), c.BuildContext.Get("SharedFrameworkCompressedFile")); + CreateZipFromDirectory(Dirs.Stage2, c.BuildContext.Get("SdkCompressedFile")); - if (File.Exists(zipFile)) - { - File.Delete(zipFile); - } - - ZipFile.CreateFromDirectory(Dirs.Stage2, zipFile, CompressionLevel.Optimal, false); return c.Success(); } @@ -134,5 +132,15 @@ namespace Microsoft.DotNet.Cli.Build return env; } + + private static void CreateZipFromDirectory(string directory, string artifactPath) + { + if (File.Exists(artifactPath)) + { + File.Delete(artifactPath); + } + + ZipFile.CreateFromDirectory(directory, artifactPath, CompressionLevel.Optimal, false); + } } }