diff --git a/Source/Activities/ClickOnce/ClickOnceDeployment.cs b/Source/Activities/ClickOnce/ClickOnceDeployment.cs index a3f2bb4..ba775ec 100644 --- a/Source/Activities/ClickOnce/ClickOnceDeployment.cs +++ b/Source/Activities/ClickOnce/ClickOnceDeployment.cs @@ -1,18 +1,19 @@ //----------------------------------------------------------------------- // (c) http://TfsBuildExtensions.codeplex.com/. This source is subject to the Microsoft Permissive License. See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. All other rights reserved. //----------------------------------------------------------------------- + +using System; +using System.Activities; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using Microsoft.Build.Tasks; +using Microsoft.Build.Utilities; +using Microsoft.TeamFoundation.Build.Client; + namespace TfsBuildExtensions.Activities.ClickOnce { - using System; - using System.Activities; - using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; - using System.IO; - using Microsoft.Build.Tasks; - using Microsoft.Build.Utilities; - using Microsoft.TeamFoundation.Build.Client; - /// /// ClickOnceDeployment /// @@ -21,6 +22,26 @@ public sealed class ClickOnceDeployment : BaseCodeActivity { private InArgument processor = "x86"; + /// + /// Publisher + /// + public InArgument Publisher { get; set; } + + /// + /// Create a desktop shortcut for the Application + /// + public InArgument CreateDesktopShortcut { get; set; } + + /// + /// Name of Icon File + /// + public InArgument IconFile { get; set; } + + /// + /// Timestamp Server Location + /// + public InArgument TimestampUri { get; set; } + /// /// Sets the Processor to use. Default is x86. /// @@ -103,6 +124,10 @@ protected override void InternalExecute() string installLocation = this.InstallLocation.Get(this.ActivityContext); string targetFrameworkVersion = this.TargetFrameworkVersion.Get(this.ActivityContext); string manifestCertificateThumbprint = this.ManifestCertificateThumbprint.Get(this.ActivityContext); + string timestampUri = this.TimestampUri.Get(this.ActivityContext); + bool createDesktopShortcut = this.CreateDesktopShortcut.Get(this.ActivityContext); + string publisher = this.Publisher.Get(this.ActivityContext); + string iconFile = this.IconFile.Get(this.ActivityContext); try { @@ -122,26 +147,29 @@ protected override void InternalExecute() string manifestCertificateThumbprintArg = !string.IsNullOrEmpty(manifestCertificateThumbprint) ? "-CertHash " + manifestCertificateThumbprint : string.Empty; string certFilePathArg = !string.IsNullOrEmpty(certFilePath) ? "-CertFile " + certFilePath : string.Empty; string certPasswordArg = !string.IsNullOrEmpty(certPassword) ? "-Password " + certPassword : string.Empty; + string timestampUriArg = !string.IsNullOrEmpty(timestampUri) ? "-TimestampUri " + timestampUri : string.Empty; + string iconFileArg = !string.IsNullOrEmpty(iconFile) ? " -IconFile " + iconFile : string.Empty; // Create Application Manifest - string args = "-New Application -Processor " + this.Processor.Get(this.ActivityContext) + " -ToFile \"" + toFile + "\\" + applicationName + ".exe.manifest\" -name " + applicationName + " -Version " + version + " -FromDirectory \"" + toFile + "\""; + string args = "-New Application -Processor " + this.Processor.Get(this.ActivityContext) + " -ToFile \"" + toFile + "\\" + applicationName + ".exe.manifest\" -name " + applicationName + " -Version " + version + " -FromDirectory \"" + toFile + "\"" + iconFileArg; RunMage(mageFilePath, args); // Sign Application Manifest - args = "-Sign \"" + toFile + "\\" + applicationName + ".exe.manifest\" " + manifestCertificateThumbprintArg + " " + certFilePathArg + " " + certPasswordArg; - RunMage(mageFilePath, args); + //args = "-Sign \"" + toFile + "\\" + applicationName + ".exe.manifest\" " + manifestCertificateThumbprintArg + " " + certFilePathArg + " " + certPasswordArg; + //RunMage(mageFilePath, args); // rename all files to have a .deploy RenameFiles(toFile); // Sign Application Manifest - args = "-Sign \"" + toFile + "\\" + applicationName + ".exe.manifest\" " + manifestCertificateThumbprintArg + " " + certFilePathArg + " " + certPasswordArg; + args = "-Sign \"" + toFile + "\\" + applicationName + ".exe.manifest\" " + manifestCertificateThumbprintArg + " " + certFilePathArg + " " + certPasswordArg + " " + timestampUriArg; + RunMage(mageFilePath, args); - CreateDeploymentManifest(version, applicationName, publishLocation, targetFrameworkVersion); + CreateDeploymentManifest(version, applicationName, publishLocation, installLocation, targetFrameworkVersion, createDesktopShortcut, publisher); // Sign Deployment Manifest - args = "-Sign \"" + publishLocation + "\\" + applicationName + ".application\" " + manifestCertificateThumbprintArg + " " + certFilePathArg + " " + certPasswordArg; + args = "-Sign \"" + publishLocation + "\\" + applicationName + ".application\" " + manifestCertificateThumbprintArg + " " + certFilePathArg + " " + certPasswordArg + " " + timestampUriArg; RunMage(mageFilePath, args); // Copy Deploy Manifest to parent folder @@ -213,7 +241,7 @@ private static void RunMage(string mageFilePath, string args) } } - private static void CreateDeploymentManifest(string version, string applicationName, string publishLocation, string targetFrameworkVersion) + private static void CreateDeploymentManifest(string version, string applicationName, string publishLocation, string installLocation, string targetFrameworkVersion, bool createDesktopShortcut, string publisher) { Dictionary metadata = new Dictionary(); metadata.Add("TargetPath", "Application Files\\" + applicationName + "_" + version + "\\" + applicationName + ".exe.manifest"); @@ -223,15 +251,16 @@ private static void CreateDeploymentManifest(string version, string applicationN AssemblyName = applicationName + ".application", AssemblyVersion = version, Product = applicationName, + Publisher = publisher, - // DeploymentUrl = installLocation, + DeploymentUrl = installLocation + applicationName + ".application", Install = true, UpdateEnabled = true, UpdateMode = "Foreground", OutputManifest = new TaskItem(publishLocation + "\\" + applicationName + ".application"), MapFileExtensions = true, EntryPoint = new TaskItem(publishLocation + @"\Application Files\" + applicationName + "_" + version + "\\" + applicationName + ".exe.manifest", metadata), - CreateDesktopShortcut = false, + CreateDesktopShortcut = createDesktopShortcut, TargetFrameworkVersion = targetFrameworkVersion, TargetFrameworkMoniker = ".NETFramework,Version=v" + targetFrameworkVersion, MinimumRequiredVersion = version