コード例 #1
0
        private void ResolveBundleInstallScope(IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable <PackageFacade> facades)
        {
            var dependencySymbolsById = section.Symbols.OfType <WixDependencyProviderSymbol>().ToDictionary(t => t.Id.Id);

            foreach (var facade in facades)
            {
                if (bundleSymbol.PerMachine && YesNoDefaultType.No == facade.PackageSymbol.PerMachine)
                {
                    this.Messaging.Write(VerboseMessages.SwitchingToPerUserPackage(facade.PackageSymbol.SourceLineNumbers, facade.PackageId));

                    bundleSymbol.Attributes &= ~WixBundleAttributes.PerMachine;
                    break;
                }
            }

            foreach (var facade in facades)
            {
                // Update package scope from bundle scope if default.
                if (YesNoDefaultType.Default == facade.PackageSymbol.PerMachine)
                {
                    facade.PackageSymbol.PerMachine = bundleSymbol.PerMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No;
                }

                // We will only register packages in the same scope as the bundle. Warn if any packages with providers
                // are in a different scope and not permanent (permanents typically don't need a ref-count).
                if (!bundleSymbol.PerMachine &&
                    YesNoDefaultType.Yes == facade.PackageSymbol.PerMachine &&
                    !facade.PackageSymbol.Permanent &&
                    dependencySymbolsById.ContainsKey(facade.PackageId))
                {
                    this.Messaging.Write(WarningMessages.NoPerMachineDependencies(facade.PackageSymbol.SourceLineNumbers, facade.PackageId));
                }
            }
        }
 public CreateBundleExtensionManifestCommand(IntermediateSection section, WixBundleSymbol bundleSymbol, int lastUXPayloadIndex, string intermediateFolder, IInternalBurnBackendHelper internalBurnBackendHelper)
 {
     this.Section                   = section;
     this.BundleSymbol              = bundleSymbol;
     this.LastUXPayloadIndex        = lastUXPayloadIndex;
     this.IntermediateFolder        = intermediateFolder;
     this.InternalBurnBackendHelper = internalBurnBackendHelper;
 }
コード例 #3
0
        private WixBundleSymbol GetBundleSymbol()
        {
            if (this.BundleSymbol == null)
            {
                using var wixOutput = WixOutput.Read(this.BundlePdb);
                var intermediate = Intermediate.Load(wixOutput);
                var section      = intermediate.Sections.Single();
                this.BundleSymbol = section.Symbols.OfType <WixBundleSymbol>().Single();
            }

            return(this.BundleSymbol);
        }
コード例 #4
0
        private static Version GetWindowsAssemblyVersion(WixBundleSymbol bundleSymbol)
        {
            // Ensure the bundle info provides a full four part version.
            var fourPartVersion = new Version(bundleSymbol.Version);
            var major           = (fourPartVersion.Major < 0) ? 0 : fourPartVersion.Major;
            var minor           = (fourPartVersion.Minor < 0) ? 0 : fourPartVersion.Minor;
            var build           = (fourPartVersion.Build < 0) ? 0 : fourPartVersion.Build;
            var revision        = (fourPartVersion.Revision < 0) ? 0 : fourPartVersion.Revision;

            if (UInt16.MaxValue < major || UInt16.MaxValue < minor || UInt16.MaxValue < build || UInt16.MaxValue < revision)
            {
                throw new WixException(ErrorMessages.InvalidModuleOrBundleVersion(bundleSymbol.SourceLineNumbers, "Bundle", bundleSymbol.Version));
            }

            return(new Version(major, minor, build, revision));
        }
コード例 #5
0
 public CreateBundleExeCommand(IMessaging messaging, IBackendHelper backendHelper, string intermediateFolder, string outputPath, WixBundleSymbol bundleSymbol, WixBundleContainerSymbol uxContainer, IEnumerable <WixBundleContainerSymbol> containers)
 {
     this.Messaging          = messaging;
     this.BackendHelper      = backendHelper;
     this.IntermediateFolder = intermediateFolder;
     this.OutputPath         = outputPath;
     this.BundleSymbol       = bundleSymbol;
     this.UXContainer        = uxContainer;
     this.Containers         = containers;
 }
コード例 #6
0
        private void UpdateBurnResources(string bundleTempPath, string outputPath, WixBundleSymbol bundleInfo)
        {
            var resources = new Dtf.Resources.ResourceCollection();
            var version   = new Dtf.Resources.VersionResource("#1", 1033);

            version.Load(bundleTempPath);
            resources.Add(version);

            // Ensure the bundle info provides a full four part version.
            var fourPartVersion = new Version(bundleInfo.Version);
            var major           = (fourPartVersion.Major < 0) ? 0 : fourPartVersion.Major;
            var minor           = (fourPartVersion.Minor < 0) ? 0 : fourPartVersion.Minor;
            var build           = (fourPartVersion.Build < 0) ? 0 : fourPartVersion.Build;
            var revision        = (fourPartVersion.Revision < 0) ? 0 : fourPartVersion.Revision;

            if (UInt16.MaxValue < major || UInt16.MaxValue < minor || UInt16.MaxValue < build || UInt16.MaxValue < revision)
            {
                throw new WixException(ErrorMessages.InvalidModuleOrBundleVersion(bundleInfo.SourceLineNumbers, "Bundle", bundleInfo.Version));
            }

            fourPartVersion        = new Version(major, minor, build, revision);
            version.FileVersion    = fourPartVersion;
            version.ProductVersion = fourPartVersion;

            var strings = version[1033] ?? version.Add(1033);

            strings["LegalCopyright"]   = bundleInfo.Copyright;
            strings["OriginalFilename"] = Path.GetFileName(outputPath);
            strings["FileVersion"]      = bundleInfo.Version; // string versions do not have to be four parts.
            strings["ProductVersion"]   = bundleInfo.Version; // string versions do not have to be four parts.

            if (!String.IsNullOrEmpty(bundleInfo.Name))
            {
                strings["ProductName"]     = bundleInfo.Name;
                strings["FileDescription"] = bundleInfo.Name;
            }

            if (!String.IsNullOrEmpty(bundleInfo.Manufacturer))
            {
                strings["CompanyName"] = bundleInfo.Manufacturer;
            }
            else
            {
                strings["CompanyName"] = String.Empty;
            }

            if (!String.IsNullOrEmpty(bundleInfo.IconSourceFile))
            {
                var iconGroup = new Dtf.Resources.GroupIconResource("#1", 1033);
                iconGroup.ReadFromFile(bundleInfo.IconSourceFile);
                resources.Add(iconGroup);

                foreach (var icon in iconGroup.Icons)
                {
                    resources.Add(icon);
                }
            }

            if (!String.IsNullOrEmpty(bundleInfo.SplashScreenSourceFile))
            {
                var bitmap = new Dtf.Resources.BitmapResource("#1", 1033);
                bitmap.ReadFromFile(bundleInfo.SplashScreenSourceFile);
                resources.Add(bitmap);
            }

            resources.Save(bundleTempPath);
        }
コード例 #7
0
 public CreateBurnManifestCommand(string executableName, IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable <WixBundleContainerSymbol> containers, WixChainSymbol chainSymbol, IEnumerable <PackageFacade> orderedPackages, IEnumerable <WixBundleRollbackBoundarySymbol> boundaries, IEnumerable <WixBundlePayloadSymbol> uxPayloads, Dictionary <string, WixBundlePayloadSymbol> allPayloadsById, Dictionary <string, Dictionary <string, WixBundlePayloadSymbol> > packagesPayloads, IEnumerable <ISearchFacade> orderedSearches, string intermediateFolder)
 {
     this.ExecutableName      = executableName;
     this.Section             = section;
     this.BundleSymbol        = bundleSymbol;
     this.Chain               = chainSymbol;
     this.Containers          = containers;
     this.OrderedPackages     = orderedPackages;
     this.RollbackBoundaries  = boundaries;
     this.UXContainerPayloads = uxPayloads;
     this.Payloads            = allPayloadsById;
     this.PackagesPayloads    = packagesPayloads;
     this.OrderedSearches     = orderedSearches;
     this.IntermediateFolder  = intermediateFolder;
 }
コード例 #8
0
 public CreateBootstrapperApplicationManifestCommand(IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable <PackageFacade> chainPackages, int lastUXPayloadIndex, Dictionary <string, WixBundlePayloadSymbol> payloadSymbols, string intermediateFolder, IInternalBurnBackendHelper internalBurnBackendHelper)
 {
     this.Section                   = section;
     this.BundleSymbol              = bundleSymbol;
     this.ChainPackages             = chainPackages;
     this.LastUXPayloadIndex        = lastUXPayloadIndex;
     this.Payloads                  = payloadSymbols;
     this.IntermediateFolder        = intermediateFolder;
     this.InternalBurnBackendHelper = internalBurnBackendHelper;
 }
コード例 #9
0
        private static void UpdateBurnResources(string bundleTempPath, string outputPath, WixBundleSymbol bundleInfo, Version windowsAssemblyVersion, byte[] applicationManifestData)
        {
            const int burnLocale = 1033;
            var       resources  = new Dtf.Resources.ResourceCollection();
            var       version    = new Dtf.Resources.VersionResource("#1", burnLocale);

            version.Load(bundleTempPath);
            resources.Add(version);

            version.FileVersion    = windowsAssemblyVersion;
            version.ProductVersion = windowsAssemblyVersion;

            var strings = version[burnLocale] ?? version.Add(burnLocale);

            strings["LegalCopyright"]   = bundleInfo.Copyright;
            strings["OriginalFilename"] = Path.GetFileName(outputPath);
            strings["FileVersion"]      = bundleInfo.Version; // string versions do not have to be four parts.
            strings["ProductVersion"]   = bundleInfo.Version; // string versions do not have to be four parts.

            if (!String.IsNullOrEmpty(bundleInfo.Name))
            {
                strings["ProductName"]     = bundleInfo.Name;
                strings["FileDescription"] = bundleInfo.Name;
            }

            if (!String.IsNullOrEmpty(bundleInfo.Manufacturer))
            {
                strings["CompanyName"] = bundleInfo.Manufacturer;
            }
            else
            {
                strings["CompanyName"] = String.Empty;
            }

            if (!String.IsNullOrEmpty(bundleInfo.IconSourceFile))
            {
                var iconGroup = new Dtf.Resources.GroupIconResource("#1", burnLocale);
                iconGroup.ReadFromFile(bundleInfo.IconSourceFile);
                resources.Add(iconGroup);

                foreach (var icon in iconGroup.Icons)
                {
                    resources.Add(icon);
                }
            }

            if (!String.IsNullOrEmpty(bundleInfo.SplashScreenSourceFile))
            {
                var bitmap = new Dtf.Resources.BitmapResource("#1", burnLocale);
                bitmap.ReadFromFile(bundleInfo.SplashScreenSourceFile);
                resources.Add(bitmap);
            }

            var manifestResource = new Resource(ResourceType.Manifest, "#1", burnLocale, applicationManifestData);

            resources.Add(manifestResource);

            resources.Save(bundleTempPath);
        }
コード例 #10
0
        private static byte[] GenerateApplicationManifest(WixBundleSymbol bundleSymbol, WixBootstrapperApplicationDllSymbol bootstrapperApplicationSymbol, string outputPath, Version windowsAssemblyVersion)
        {
            const string asmv1Namespace    = "urn:schemas-microsoft-com:asm.v1";
            const string asmv3Namespace    = "urn:schemas-microsoft-com:asm.v3";
            const string compatv1Namespace = "urn:schemas-microsoft-com:compatibility.v1";
            const string ws2005Namespace   = "http://schemas.microsoft.com/SMI/2005/WindowsSettings";
            const string ws2016Namespace   = "http://schemas.microsoft.com/SMI/2016/WindowsSettings";
            const string ws2017Namespace   = "http://schemas.microsoft.com/SMI/2017/WindowsSettings";

            var bundleFileName        = Path.GetFileName(outputPath);
            var bundleAssemblyVersion = windowsAssemblyVersion.ToString();
            var bundlePlatform        = bundleSymbol.Platform.ToString().ToLower();
            var bundleDescription     = bundleSymbol.Name;

            using (var memoryStream = new MemoryStream())
                using (var writer = new XmlTextWriter(memoryStream, Encoding.UTF8))
                {
                    writer.WriteStartDocument();

                    writer.WriteStartElement("assembly", asmv1Namespace);
                    writer.WriteAttributeString("manifestVersion", "1.0");

                    writer.WriteStartElement("assemblyIdentity");
                    writer.WriteAttributeString("name", bundleFileName);
                    writer.WriteAttributeString("version", bundleAssemblyVersion);
                    writer.WriteAttributeString("processorArchitecture", bundlePlatform);
                    writer.WriteAttributeString("type", "win32");
                    writer.WriteEndElement(); // </assemblyIdentity>

                    if (!String.IsNullOrEmpty(bundleDescription))
                    {
                        writer.WriteStartElement("description");
                        writer.WriteString(bundleDescription);
                        writer.WriteEndElement();
                    }

                    writer.WriteStartElement("dependency");
                    writer.WriteStartElement("dependentAssembly");
                    writer.WriteStartElement("assemblyIdentity");
                    writer.WriteAttributeString("name", "Microsoft.Windows.Common-Controls");
                    writer.WriteAttributeString("version", "6.0.0.0");
                    writer.WriteAttributeString("processorArchitecture", bundlePlatform);
                    writer.WriteAttributeString("publicKeyToken", "6595b64144ccf1df");
                    writer.WriteAttributeString("language", "*");
                    writer.WriteAttributeString("type", "win32");
                    writer.WriteEndElement(); // </assemblyIdentity>
                    writer.WriteEndElement(); // </dependentAssembly>
                    writer.WriteEndElement(); // </dependency>

                    writer.WriteStartElement("compatibility", compatv1Namespace);
                    writer.WriteStartElement("application");

                    writer.WriteStartElement("supportedOS");
                    writer.WriteAttributeString("Id", "{e2011457-1546-43c5-a5fe-008deee3d3f0}"); // Windows Vista
                    writer.WriteEndElement();
                    writer.WriteStartElement("supportedOS");
                    writer.WriteAttributeString("Id", "{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"); // Windows 7
                    writer.WriteEndElement();
                    writer.WriteStartElement("supportedOS");
                    writer.WriteAttributeString("Id", "{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"); // Windows 8
                    writer.WriteEndElement();
                    writer.WriteStartElement("supportedOS");
                    writer.WriteAttributeString("Id", "{1f676c76-80e1-4239-95bb-83d0f6d0da78}"); // Windows 8.1
                    writer.WriteEndElement();
                    writer.WriteStartElement("supportedOS");
                    writer.WriteAttributeString("Id", "{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"); // Windows 10
                    writer.WriteEndElement();

                    writer.WriteEndElement(); // </application>
                    writer.WriteEndElement(); // </compatibility>

                    writer.WriteStartElement("trustInfo", asmv3Namespace);
                    writer.WriteStartElement("security");
                    writer.WriteStartElement("requestedPrivileges");
                    writer.WriteStartElement("requestedExecutionLevel");
                    writer.WriteAttributeString("level", "asInvoker");
                    writer.WriteAttributeString("uiAccess", "false");
                    writer.WriteEndElement(); // </requestedExecutionLevel>
                    writer.WriteEndElement(); // </requestedPrivileges>
                    writer.WriteEndElement(); // </security>
                    writer.WriteEndElement(); // </trustInfo>

                    if (bootstrapperApplicationSymbol.DpiAwareness != WixBootstrapperApplicationDpiAwarenessType.Unaware)
                    {
                        string dpiAwareValue     = null;
                        string dpiAwarenessValue = null;
                        string gdiScalingValue   = null;

                        switch (bootstrapperApplicationSymbol.DpiAwareness)
                        {
                        case WixBootstrapperApplicationDpiAwarenessType.GdiScaled:
                            gdiScalingValue = "true";
                            break;

                        case WixBootstrapperApplicationDpiAwarenessType.PerMonitor:
                            dpiAwareValue = "true/pm";
                            break;

                        case WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2:
                            dpiAwareValue     = "true/pm";
                            dpiAwarenessValue = "PerMonitorV2, PerMonitor";
                            break;

                        case WixBootstrapperApplicationDpiAwarenessType.System:
                            dpiAwareValue = "true";
                            break;
                        }

                        writer.WriteStartElement("application", asmv3Namespace);
                        writer.WriteStartElement("windowsSettings");

                        if (dpiAwareValue != null)
                        {
                            writer.WriteStartElement("dpiAware", ws2005Namespace);
                            writer.WriteString(dpiAwareValue);
                            writer.WriteEndElement();
                        }

                        if (dpiAwarenessValue != null)
                        {
                            writer.WriteStartElement("dpiAwareness", ws2016Namespace);
                            writer.WriteString(dpiAwarenessValue);
                            writer.WriteEndElement();
                        }

                        if (gdiScalingValue != null)
                        {
                            writer.WriteStartElement("gdiScaling", ws2017Namespace);
                            writer.WriteString(gdiScalingValue);
                            writer.WriteEndElement();
                        }

                        writer.WriteEndElement(); // </windowSettings>
                        writer.WriteEndElement(); // </application>
                    }

                    writer.WriteEndDocument(); // </assembly>
                    writer.Close();

                    return(memoryStream.ToArray());
                }
        }