Exemple #1
0
        /// <summary>
        /// Adds one or more arbitrary files to the installation.
        /// </summary>
        /// <param name="targetroot">Base folder on the installation site.</param>
        /// <param name="sTargetRelativeDir">Relative path from the base folder on the installation site.</param>
        /// <param name="sourceroot">Base folder on the compilation site.</param>
        /// <param name="sSourceRelativeDir">Relative path from the base folder on the compilation site.</param>
        /// <param name="sFilesMask">Mask for picking the files from the folder on the compilation site (source). More than one file is OK. File names will be the same on the installation site (target).</param>
        /// <param name="id">The unique identifier for this installation entry.</param>
        public InstallFileAttribute([NotNull] string id, TargetRootXml targetroot, [NotNull] string sTargetRelativeDir, SourceRootXml sourceroot, [NotNull] string sSourceRelativeDir, [NotNull] string sFilesMask, string sMsiGuid)
        {
            if (sTargetRelativeDir == null)
            {
                throw new ArgumentNullException("sTargetRelativeDir");
            }
            if (sSourceRelativeDir == null)
            {
                throw new ArgumentNullException("sSourceRelativeDir");
            }
            if (sFilesMask == null)
            {
                throw new ArgumentNullException("sFilesMask");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }

            _TargetRoot        = targetroot;
            _Id                = id;
            _TargetRelativeDir = sTargetRelativeDir;
            _SourceRoot        = sourceroot;
            _SourceRelativeDir = sSourceRelativeDir;
            _FilesMask         = sFilesMask;
            _MsiGuid           = new Guid(sMsiGuid);
        }
        /// <summary>
        /// Root -> file system path.
        /// </summary>
        private static string ResolveTargetDirRoot(TargetRootXml root, Bag bag)
        {
            switch (root)
            {
            case TargetRootXml.InstallDir:
                return(bag.GetString(AttributeName.ProductBinariesDir));

            default:
                throw new InvalidOperationException(string.Format("Unsupported installation data file target root “{0}”.", root));
            }
        }