Exemplo n.º 1
0
        public void MapFile([NotNull] string filePath, [NotNull] WixFileNode node)
        {
            Contract.Requires(filePath != null);
            Contract.Requires(node != null);

            MapElement(filePath, node, _configuration.FileMappings);
        }
Exemplo n.º 2
0
        internal WixFileNode AddFileComponent([NotNull] WixComponentGroupNode componentGroup, [NotNull] string id, [NotNull] string name, [NotNull] FileMapping fileMapping)
        {
            Debug.Assert(componentGroup.SourceFile.Equals(this));

            var project = fileMapping.Project;

            var variableName = string.Format(CultureInfo.InvariantCulture, "{0}_TargetDir", project.Name);

            ForceDirectoryVariable(variableName, project);

            var componentElement = new XElement(WixNames.ComponentNode, new XAttribute("Id", id), new XAttribute("Guid", Guid.NewGuid().ToString()));

            componentGroup.Node.AddWithFormatting(componentElement);

            var source = string.Format(CultureInfo.InvariantCulture, "$(var.{0}){1}", variableName, fileMapping.SourceName);

            var fileElement = new XElement(WixNames.FileNode, new XAttribute("Id", id), new XAttribute("Name", name), new XAttribute("Source", source));

            componentElement.AddWithFormatting(fileElement);

            Save();

            var fileNode = new WixFileNode(componentGroup.SourceFile, fileElement, _fileNodes);

            _fileNodes.Add(fileNode);
            return(fileNode);
        }