示例#1
0
 public CreateNonUXContainers(IBackendHelper backendHelper, IntermediateSection section, WixBootstrapperApplicationDllSymbol bootstrapperApplicationDllSymbol, Dictionary <string, WixBundlePayloadSymbol> payloadSymbols, string intermediateFolder, string layoutFolder, CompressionLevel?defaultCompressionLevel)
 {
     this.BackendHelper = backendHelper;
     this.Section       = section;
     this.BootstrapperApplicationDllSymbol = bootstrapperApplicationDllSymbol;
     this.PayloadSymbols          = payloadSymbols;
     this.IntermediateFolder      = intermediateFolder;
     this.LayoutFolder            = layoutFolder;
     this.DefaultCompressionLevel = defaultCompressionLevel;
 }
示例#2
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());
                }
        }
示例#3
0
 public CreateBundleExeCommand(IMessaging messaging, IBackendHelper backendHelper, string intermediateFolder, string outputPath, WixBootstrapperApplicationDllSymbol bootstrapperApplicationDllSymbol, WixBundleSymbol bundleSymbol, WixBundleContainerSymbol uxContainer, IEnumerable <WixBundleContainerSymbol> containers)
 {
     this.Messaging          = messaging;
     this.BackendHelper      = backendHelper;
     this.IntermediateFolder = intermediateFolder;
     this.OutputPath         = outputPath;
     this.BootstrapperApplicationDllSymbol = bootstrapperApplicationDllSymbol;
     this.BundleSymbol = bundleSymbol;
     this.UXContainer  = uxContainer;
     this.Containers   = containers;
 }
示例#4
0
 public CreateNonUXContainers(IBackendHelper backendHelper, IMessaging messaging, WixBootstrapperApplicationDllSymbol bootstrapperApplicationDllSymbol, IEnumerable <WixBundleContainerSymbol> containerSymbols, Dictionary <string, WixBundlePayloadSymbol> payloadSymbols, string intermediateFolder, string layoutFolder, CompressionLevel?defaultCompressionLevel)
 {
     this.BackendHelper = backendHelper;
     this.Messaging     = messaging;
     this.BootstrapperApplicationDllSymbol = bootstrapperApplicationDllSymbol;
     this.Containers              = containerSymbols;
     this.PayloadSymbols          = payloadSymbols;
     this.IntermediateFolder      = intermediateFolder;
     this.LayoutFolder            = layoutFolder;
     this.DefaultCompressionLevel = defaultCompressionLevel;
 }