Example #1
0
        private void Init(string name)
        {
            WiXElement.AppendAttribute(
                thisElement,
                "Name",
                Path.GetFileName(name));

            WiXElement.AppendAttribute(
                thisElement,
                "Id",
                "Remove" + Guid.NewGuid().ToString("b").Trim('{', '}').Replace("-", ""));

            WiXElement.AppendAttribute(
                thisElement,
                "On",
                "uninstall");
        }
Example #2
0
        public File(Component parent, string name, string source, bool numberedID)
            : base(parent.Element, "File", "REPLACE_ID")
        {
            if (string.IsNullOrEmpty(name))
            {
                name = source;
            }

            string filePart = Path.GetFileNameWithoutExtension(name);

            string ext = Path.GetExtension(name);

            if (ext.Length > 0)
            {
                ext = ext.Substring(1);
            }

            thisElement.Attributes["Id"].Value =
                numberedID
                    ? "file" + fileCount++
                    : IdFromNameAndComponent(source, parent);

            WiXElement.AppendAttribute(
                thisElement,
                "Name",
                Path.GetFileName(name));

            WiXElement.AppendAttribute(
                thisElement, "Source", source);

            WiXElement.AppendAttribute(
                thisElement, "DiskId", "1");


            /* FIX THIS TO ADD REMOVEFILE FOR EACH FILE */
            if (parent.Element.OwnerDocument != null)
            {
                new RemoveFile(parent.Element, name);
            }
        }