Exemplo n.º 1
0
        public static string ReplacePlaceholders(string original, Assembly assembly)
        {
            if (null != assembly)
            {
                FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);

                original = original.Replace("[FileComments]", fileVersion.Comments);
                original = original.Replace("[FileCopyright]", fileVersion.LegalCopyright);
                original = original.Replace("[FileProductName]", fileVersion.ProductName);
                original = original.Replace("[FileVersion]", fileVersion.FileVersion);

                if (original.Contains("[FileVersionMajorMinor]"))
                {
                    Version version = new Version(fileVersion.FileVersion);
                    original = original.Replace("[FileVersionMajorMinor]", String.Concat(version.Major, ".", version.Minor));
                }

                AssemblyCompanyAttribute company;
                if (WixDistribution.TryGetAttribute(assembly, out company))
                {
                    original = original.Replace("[AssemblyCompany]", company.Company);
                }

                AssemblyCopyrightAttribute copyright;
                if (WixDistribution.TryGetAttribute(assembly, out copyright))
                {
                    original = original.Replace("[AssemblyCopyright]", copyright.Copyright);
                }

                AssemblyDescriptionAttribute description;
                if (WixDistribution.TryGetAttribute(assembly, out description))
                {
                    original = original.Replace("[AssemblyDescription]", description.Description);
                }

                AssemblyProductAttribute product;
                if (WixDistribution.TryGetAttribute(assembly, out product))
                {
                    original = original.Replace("[AssemblyProduct]", product.Product);
                }

                AssemblyTitleAttribute title;
                if (WixDistribution.TryGetAttribute(assembly, out title))
                {
                    original = original.Replace("[AssemblyTitle]", title.Title);
                }
            }

            original = original.Replace("[NewsUrl]", WixDistribution.NewsUrl);
            original = original.Replace("[ShortProduct]", WixDistribution.ShortProduct);
            original = original.Replace("[SupportUrl]", WixDistribution.SupportUrl);
            return(original);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Displays help message header on Console for caller tool.
        /// </summary>
        public static void DisplayToolHeader()
        {
            Assembly assembly = Assembly.GetCallingAssembly();

            Console.WriteLine(WixDistribution.ReplacePlaceholders(WixDistributionSpecificStrings.ToolsetHelpHeader, assembly));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Displays help message header on Console for caller tool.
 /// </summary>
 public static void DisplayToolFooter()
 {
     Console.Write(WixDistribution.ReplacePlaceholders(WixDistributionSpecificStrings.ToolsetHelpFooter, null));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates and returns the string for CreatingApplication field (MSI Summary Information Stream).
        /// </summary>
        /// <remarks>It reads the AssemblyProductAttribute and AssemblyVersionAttribute of executing assembly
        /// and builds the CreatingApplication string of the form "[ProductName] ([ProductVersion])".</remarks>
        /// <returns>Returns value for PID_APPNAME."</returns>
        public static string GetCreatingApplicationString()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            return(WixDistribution.ReplacePlaceholders("[AssemblyProduct] ([FileVersion])", assembly));
        }