public ResolveWildCards ( bool ignoreEmptyDirectories = false ) : |
||
ignoreEmptyDirectories | bool | if set to |
return |
public static void Main(string[] args) { var project = new Project("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", //new Dir("Documentation", new Files(@"\\BUILDSERVER\My Product\Release\Documentation\*.*")), //uncomment if you have a real remote files to install new Files(@"..\Release Folder\Release\*.*", f => !f.EndsWith(".obj") && !f.EndsWith(".pdb")), new ExeFileShortcut("Uninstall My Product", "[System64Folder]msiexec.exe", "/x [ProductCode]"))); project.SourceBaseDir = @"E:\Galos\Projects\WixSharp\src\WixSharp.Samples\Wix# Samples\Release Folder"; project.GUID = new Guid("6f330b47-2577-43ad-9095-1561ba25889b"); project.ResolveWildCards(ignoreEmptyDirectories: true) .FindFile((f) => f.Name.EndsWith("MyApp.exe")) .First() .Shortcuts = new[] { new FileShortcut("MyApp.exe", "INSTALLDIR"), new FileShortcut("MyApp.exe", "%Desktop%") }; Compiler.PreserveTempFiles = true; Compiler.EmitRelativePaths = false; Compiler.BuildMsi(project); }
public static void Main(string[] args) { var project = new Project("MyProduct", new Dir(@"%ProgramFiles%\MyCompany\MyProduct", new DirFiles(@"Release\Bin\*.*"), new Dir("GlobalResources", new DirFiles(@"Release\Bin\GlobalResources\*.*")), new Dir("Images", new DirFiles(@"Release\Bin\Images\*.*")), new ExeFileShortcut("Uninstall MyProduct", "[System64Folder]msiexec.exe", "/x [ProductCode]"))); project.UI = WUI.WixUI_FeatureTree; project.GUID = new Guid("{AC19C6E4-9724-4e90-8AC7-6E69B4AB7562}"); project.ResolveWildCards(); var exeFile = project.AllFiles.Single(f=>f.Name.EndsWith("some.exe")); exeFile.Shortcuts = new[] { new FileShortcut("some.exe", "INSTALLDIR"), new FileShortcut("some.exe", @"%Desktop%") }; Compiler.BuildMsi(project); }
public static string Execute() { Feature obsPlugin = new Feature("Obs Plugin"); var obsDir = new Dir(@"%ProgramFiles%\OBS\plugins", new File(obsPlugin, @"ObsPlugin\CLRHostPlugin.dll"), new Dir(obsPlugin, "CLRHostPlugin", new DirFiles(obsPlugin, @"ObsPlugin\CLRHostPlugin\*.*") )); Project project = new Project("OBS plugin for digiCamControl",obsDir); project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#378389'", "Please install .Net 4.5 First"); project.UI = WUI.WixUI_Minimal; project.GUID = new Guid("357E0D80-5093-478E-8C11-28B1A72096E7"); #if DEBUG project.SourceBaseDir = Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Debug\")); #else project.SourceBaseDir = Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Release\")); #endif FileVersionInfo ver = null; try { ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, @"ObsPlugin\CLRHostPlugin", "DccObsPlugin.dll")); } catch (FileNotFoundException ex) { project.SourceBaseDir = project.SourceBaseDir.Replace(@"Setup\bin\", ""); ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, @"ObsPlugin\CLRHostPlugin", "DccObsPlugin.dll")); } project.LicenceFile = @"Licenses\DigiCamControlLicence.rtf"; project.Version = new Version(ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart, ver.FilePrivatePart); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; //project.MajorUpgradeStrategy.NewerProductInstalledErrorMessage = "A version of the digiCamControl already installed. Unistall it first from Control Panel !"; project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; ////project.MajorUpgradeStrategy.UpgradeVersions = VersionRange.ThisAndOlder; ////project.MajorUpgradeStrategy.PreventDowngradingVersions = VersionRange.ThisAndOlder; project.ControlPanelInfo.Manufacturer = "Duka Istvan"; project.OutFileName = string.Format("ObsPluginSetup_{0}", ver.FileVersion); project.ControlPanelInfo.ProductIcon = "logo.ico"; project.InstallScope = InstallScope.perMachine; project.ResolveWildCards(); Compiler.PreserveTempFiles = false; return Compiler.BuildMsi(project); }
static void Main() { var project = new Project("PhotoSorter", new Dir(new Id("INSTALLDIR"), @"%LocalAppData%\PhotoSorter", new File(@"..\PhotoSorter\bin\Release\PhotoSorter.exe", new FileShortcut("PhotoSorter", @"%Desktop%"), new FileShortcut("PhotoSorter", @"%ProgramMenu%\PhotoSorter")), new Files(@"..\PhotoSorter\bin\Release\*.*", f => !f.EndsWith(".pdb") && !f.Contains("vshost") && !f.EndsWith("PhotoSorter.exe")), new ExeFileShortcut("Uninstall PhotoSorter", "[System64Folder]msiexec.exe", "/x [ProductCode]") { WorkingDirectory = "%Temp%" }) ); project.GUID = new Guid("{5E1EED8B-5CEB-4EE7-BD2D-B7A4BFA836C0}"); project.Codepage = "1251"; project.Language = "ru-RU"; project.SetVersionFromFile(@"..\PhotoSorter\bin\Release\PhotoSorter.exe"); project.Media.CompressionLevel = CompressionLevel.high; project.Media.EmbedCab = true; project.UI = WUI.WixUI_Common; project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; project.InstallScope = InstallScope.perUser; var customUi = new CustomUI(); customUi.On(NativeDialogs.ExitDialog, Buttons.Finish, new CloseDialog() { Order = 9999 }); customUi.On(NativeDialogs.WelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.InstallDirDlg)); customUi.On(NativeDialogs.InstallDirDlg, Buttons.Back, new ShowDialog(NativeDialogs.WelcomeDlg)); customUi.On(NativeDialogs.InstallDirDlg, Buttons.Next, new SetTargetPath(), new ShowDialog(NativeDialogs.VerifyReadyDlg)); customUi.On(NativeDialogs.InstallDirDlg, Buttons.ChangeFolder, new SetProperty("_BrowseProperty", "[WIXUI_INSTALLDIR]"), new ShowDialog(CommonDialogs.BrowseDlg)); customUi.On(NativeDialogs.VerifyReadyDlg, Buttons.Back, new ShowDialog(NativeDialogs.InstallDirDlg, Condition.NOT_Installed), new ShowDialog(NativeDialogs.MaintenanceTypeDlg, Condition.Installed)); customUi.On(NativeDialogs.MaintenanceWelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.MaintenanceTypeDlg)); customUi.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Back, new ShowDialog(NativeDialogs.MaintenanceWelcomeDlg)); customUi.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Repair, new ShowDialog(NativeDialogs.VerifyReadyDlg)); customUi.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Remove, new ShowDialog(NativeDialogs.VerifyReadyDlg)); project.SetNetFxPrerequisite(Condition.Net45_Installed, "Please install .Net FrameWork 4.5"); project.CustomUI = customUi; project.OutFileName = "PhotoSorterSetup"; project.PreserveTempFiles = true; project.ResolveWildCards(true); project.BuildMsi(); }
private static void Main(string[] args) { var dir = new DirectoryInfo(@"..\..\..\FirmwarePacker\bin\Release"); string exeFileFullName = dir.EnumerateFiles("*.exe").First().FullName; string exeFileName = Path.GetFileName(exeFileFullName); Assembly assembly = Assembly.LoadFile(exeFileFullName); const string projectName = "FmPack"; var mainFeature = new Feature("Программа", true) { AllowChange = false, ConfigurableDir = "INSTALLDIR" }; var project = new Project(projectName, new Dir(mainFeature, InstallerHelper.GetSautProgramLocation(projectName), new Files(dir.FullName + "\\*.*", InstallerHelper.IsFileDesired)), // Environment Variables new EnvironmentVariable("FmPack", "\"[INSTALLDIR]" + exeFileName + "\""), // Shortcuts new Dir(mainFeature, @"%ProgramMenu%\saut", new ExeFileShortcut(projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" } ), new Dir(mainFeature, "%Desktop%", new ExeFileShortcut(mainFeature, projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" } )) { DefaultFeature = mainFeature, OutDir = @"..\..\..\installers" }; project.ResolveWildCards(true) .FindFile(f => f.Name.EndsWith(exeFileName)) .First() .AddAssociation(new FileAssociation("fpc", "application/firmware-project", "Открыть", "\"%1\"") { Icon = "project.ico", Description = "Файл проекта для FmPack" }); project.SetBasicThings(new Guid("1E7AA096-4665-4BE0-A5EB-D7EE62616E38"), DotNetVersion.DotNet4); project.SetInterface(InstallerInterfaceKind.SelectDirectory); project.SetProjectInformation(assembly, @"..\..\..\FirmwarePacker\icon.ico", "https://repo.nposaut.ru/#/tools?tool=FmPack"); string msi = Compiler.BuildMsi(project); InstallerHelper.SignInstaller(msi); }
private static void Main(string[] args) { var dir = new DirectoryInfo(@"..\..\..\LightUpdater\bin\Release"); string exeFileFullName = dir.EnumerateFiles("*.exe").First().FullName; string exeFileName = Path.GetFileName(exeFileFullName); Assembly assembly = Assembly.LoadFile(exeFileFullName); string projectName = assembly.GetCustomAttributes<AssemblyTitleAttribute>().First().Title; var mainFeature = new Feature("Программа", true) { AllowChange = false, ConfigurableDir = "INSTALLDIR" }; var project = new Project(projectName, new Dir(mainFeature, InstallerHelper.GetSautProgramLocation(projectName), new Files(dir.FullName + "\\*.*", InstallerHelper.IsFileDesired)), // Shortcuts new Dir(mainFeature, @"%ProgramMenu%", new ExeFileShortcut(projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" }, new ExeFileShortcut(projectName + " (250 кбод)", "[INSTALLDIR]" + exeFileName, "/can1:250000 /can2:250000") { WorkingDirectory = "INSTALLDIR" } ), new Dir(mainFeature, "%Desktop%", new ExeFileShortcut(mainFeature, projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" } )) { DefaultFeature = mainFeature, OutDir = @"..\..\.." }; project.ResolveWildCards(true) .FindFile(f => f.Name.EndsWith(exeFileName)) .First() .AddAssociation(new FileAssociation("sfp", "application/firmware-package", "Прошить", "\"%1\"") { Icon = "sfp.ico", Description = "Файл пакета прошивки" }); project.SetBasicThings(new Guid("B390695C-291F-4B7F-8E13-1630F2BF12F1"), DotNetVersion.DotNet4); project.SetInterface(InstallerInterfaceKind.SelectDirectory); project.SetProjectInformation(assembly, @"..\..\..\LightUpdater\icon.ico", "https://repo.nposaut.ru/#/tools?tool=CanProg"); string msi = Compiler.BuildMsi(project); InstallerHelper.SignInstaller(msi); Console.ReadLine(); }
public static void Main(string[] args) { Feature appFeature = new Feature("Application files", "Main application files", true, false, @"INSTALLDIR"); var shortcut = new FileShortcut(appFeature, "digiCamControl", @"%ProgramMenu%\digiCamControl") { WorkingDirectory = @"INSTALLDIR" }; var shortcutD = new FileShortcut(appFeature, "digiCamControl", @"%Desktop%") { WorkingDirectory = @"INSTALLDIR" }; var appDir = new Dir(@"digiCamControl", new File(appFeature, "CameraControl.exe", shortcut, shortcutD), new File(appFeature, "CameraControl.PluginManager.exe"), new File(appFeature, "CameraControlCmd.exe"), new File(appFeature, "CameraControlRemoteCmd.exe"), new File(appFeature, "dcraw.exe"), new File(appFeature, "ffmpeg.exe"), new File(appFeature, "ngrok.exe"), new File(appFeature, "MtpTester.exe"), //new File(appFeature, "PhotoBooth.exe",new FileShortcut(appFeature, "PhotoBooth", @"%ProgramMenu%\digiCamControl")), new DirFiles(appFeature, @"*.dll"), #if DEBUG new DirFiles(appFeature, @"*.pdb"), #endif new File(appFeature, "regwia.bat"), new File(appFeature, "logo.ico"), new File(appFeature, "logo_big.jpg"), new File(appFeature, "baseMtpDevice.xml"), new DirFiles(appFeature, @"*.png"), new File(appFeature, "DigiCamControl.xbs"), new Dir(appFeature, "Data", new Files(appFeature, @"Data\*.*")), //new Dir(appFeature, "Plugins", // new Files(appFeature, @"Plugins\*.*", "MahApps.Metro.*", "System.Windows.Interactivity.*", // "WriteableBitmapEx.Wpf.*", "GalaSoft.MvvmLight.*", "*.config")), new Dir(appFeature, "Plugins", new Dir(appFeature, "CameraControl.Plugins", new File(appFeature, "Plugins\\CameraControl.Plugins\\CameraControl.Plugins.dll"), new File(appFeature, "Plugins\\CameraControl.Plugins\\dcc.plugin")), new Dir(appFeature, "Plugin.DeviceControlBox", new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\Plugin.DeviceControlBox.dll"), new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\dcc.plugin")) ), new Dir(appFeature, "Languages", new DirFiles(appFeature, @"Languages\*.xml")), new Dir(appFeature, "Licenses", new DirFiles(appFeature, @"Licenses\*.*")), new Dir(appFeature, "x64", new DirFiles(appFeature, @"x64\*.*")), new Dir(appFeature, "x86", new DirFiles(appFeature, @"x86\*.*")), new Dir(appFeature, "Tools", new DirFiles(appFeature, @"Tools\*.*")), new Dir(appFeature, "WebServer", new Files(appFeature, @"WebServer\*.*")) ); var baseDir = new Dir(@"%ProgramFiles%", appDir ); Project project = new Project("digiCamControl", baseDir, new ManagedAction(@"MyAction", Return.ignore, When.Before, Step.InstallExecute, Condition.NOT_Installed, Sequence.InstallExecuteSequence), new ManagedAction(@"SetRightAction", Return.ignore, When.Before, Step.InstallFinalize, Condition.Always, Sequence.InstallExecuteSequence) ); project.UI = WUI.WixUI_InstallDir; project.GUID = new Guid("19d12628-7654-4354-a305-9ab0932af676"); project.SetNetFxPrerequisite("NETFRAMEWORK40FULL='#1'"); #if DEBUG project.SourceBaseDir = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Debug\")); #else project.SourceBaseDir = Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Release\")); #endif FileVersionInfo ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "CameraControl.exe")); project.LicenceFile = @"Licenses\DigiCamControlLicence.rtf"; project.Version = new Version(ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart, ver.FilePrivatePart); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; //project.MajorUpgradeStrategy.NewerProductInstalledErrorMessage = "A version of the digiCamControl already installed. Unistall it first from Control Panel !"; project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; ////project.MajorUpgradeStrategy.UpgradeVersions = VersionRange.ThisAndOlder; ////project.MajorUpgradeStrategy.PreventDowngradingVersions = VersionRange.ThisAndOlder; project.ControlPanelInfo.Manufacturer = "Duka Istvan"; project.OutFileName = string.Format("digiCamControlsetup_{0}", ver.FileVersion); project.ControlPanelInfo.ProductIcon = "logo.ico"; if (System.IO.Directory.Exists(Path.Combine(project.SourceBaseDir, "Branding"))) { appDir.AddDir(new Dir(appFeature, "Branding", new Files(appFeature, @"Branding\*.*"))); } string branding = Path.Combine(project.SourceBaseDir, "branding.xml"); if (System.IO.File.Exists(branding)) { var doc = new XmlDocument(); doc.LoadXml(System.IO.File.ReadAllText(branding)); string name = doc.DocumentElement.SelectSingleNode("/Branding/ApplicationTitle").InnerText; project.ControlPanelInfo.Manufacturer = name; project.OutFileName = string.Format(name.Replace(" ", "_") + "_{0}", ver.FileVersion); appDir.AddFile(new File(appFeature, "branding.xml")); project.Name = name; if (System.IO.File.Exists(Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"))) { project.ControlPanelInfo.ProductIcon = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"); shortcut.IconFile = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"); shortcutD.IconFile = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"); shortcut.Name = name; shortcutD.Name = name; } if (System.IO.File.Exists(Path.Combine(project.SourceBaseDir, "Branding", "Licence.rtf"))) project.ControlPanelInfo.ProductIcon = "Branding\\Licence.rtf"; } project.ResolveWildCards(); Compiler.PreserveTempFiles = true; Compiler.BuildMsi(project); ObsPluginSetup.Execute(); }
static void Main(string[] args) { Feature appFeature = new Feature("Application files", "Main application files", true, false, @"INSTALLDIR"); var shortcut = new FileShortcut(appFeature, "ShootingLab", @"%ProgramMenu%\digiCamControl") { WorkingDirectory = @"INSTALLDIR" }; var shortcutD = new FileShortcut(appFeature, "ShootingLab", @"%Desktop%") { WorkingDirectory = @"INSTALLDIR" }; var appDir = new Dir(@"ShootingLab", new WixSharp.File(appFeature, "ShootingLab.exe", shortcut, shortcutD), new DirFiles(appFeature, @"*.dll") //new WixSharp.File(appFeature, "shootingLab.ico") ); var baseDir = new Dir(@"%ProgramFiles%\", appDir); Project project = new Project("ShootingLab", new LaunchCondition("NET40=\"#1\"", "Please install .NET 4.0 first."), baseDir, new RegValueProperty("NET40", RegistryHive.LocalMachine, @"Software\Microsoft\NET Framework Setup\NDP\v4\Full", "Install", "0"), new ManagedAction(@"MyAction", Return.ignore, When.Before, Step.InstallExecute, Condition.NOT_Installed, Sequence.InstallExecuteSequence), new ManagedAction(@"SetRightAction", Return.ignore, When.Before, Step.InstallFinalize, Condition.Always, Sequence.InstallExecuteSequence) ); project.UI = WUI.WixUI_FeatureTree; project.GUID = new Guid("4E22C775-897C-41D5-8009-1A4A616149B2"); project.SourceBaseDir = Path.GetFullPath(@"C:\Développements\LaboPDV\ShootingLab\bin\Release\"); FileVersionInfo ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "ShootingLab.exe")); //project.LicenceFile = @"Licenses\ShootingLabLicence.rtf"; project.Version = new Version(ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart, ver.FilePrivatePart); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; project.ControlPanelInfo.Manufacturer = "PixVert"; project.OutFileName = string.Format("ShootingLabSetup_{0}", ver.FileVersion); //project.ControlPanelInfo.ProductIcon = "shootingLab.ico"; project.ResolveWildCards(); Compiler.PreserveTempFiles = true; Compiler.BuildMsi(project); }
public static void Main(string[] args) { Feature appFeature = new Feature("Application files", "Main application files", true, false, @"INSTALLDIR"); var shortcut = new FileShortcut(appFeature, "digiCamControl", @"%ProgramMenu%\digiCamControl") { WorkingDirectory = @"INSTALLDIR" }; var shortcutD = new FileShortcut(appFeature, "digiCamControl", @"%Desktop%") { WorkingDirectory = @"INSTALLDIR" }; var appDir = new Dir(@"digiCamControl", new File(appFeature, "CameraControl.exe", shortcut, shortcutD), new File(appFeature, "CameraControl.PluginManager.exe"), new File(appFeature, "CameraControlCmd.exe"), new File(appFeature, "CameraControlRemoteCmd.exe"), new File(appFeature, "dcraw.exe"), new File(appFeature, "ffmpeg.exe"), new File(appFeature, "ngrok.exe"), new File(appFeature, "MtpTester.exe"), //new File(appFeature, "PhotoBooth.exe",new FileShortcut(appFeature, "PhotoBooth", @"%ProgramMenu%\digiCamControl")), new DirFiles(appFeature, @"*.dll"), #if DEBUG new DirFiles(appFeature, @"*.pdb"), #endif new File(appFeature, "regwia.bat"), new File(appFeature, "logo.ico"), new File(appFeature, "logo_big.jpg"), new File(appFeature, "baseMtpDevice.xml"), new DirFiles(appFeature, @"*.png"), new File(appFeature, "DigiCamControl.xbs"), new Dir(appFeature, "Data", new Files(appFeature, @"Data\*.*")), //new Dir(appFeature, "Plugins", // new Files(appFeature, @"Plugins\*.*", "MahApps.Metro.*", "System.Windows.Interactivity.*", // "WriteableBitmapEx.Wpf.*", "GalaSoft.MvvmLight.*", "*.config")), new Dir(appFeature, "Plugins", new Dir(appFeature, "CameraControl.Plugins", new File(appFeature, "Plugins\\CameraControl.Plugins\\CameraControl.Plugins.dll"), new File(appFeature, "Plugins\\CameraControl.Plugins\\dcc.plugin")), new Dir(appFeature, "Plugin.DeviceControlBox", new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\Plugin.DeviceControlBox.dll"), new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\dcc.plugin")) ), new Dir(appFeature, "Languages", new DirFiles(appFeature, @"Languages\*.xml")), new Dir(appFeature, "Licenses", new DirFiles(appFeature, @"Licenses\*.*")), new Dir(appFeature, "x64", new DirFiles(appFeature, @"x64\*.*")), new Dir(appFeature, "x86", new DirFiles(appFeature, @"x86\*.*")), new Dir(appFeature, "Tools", new DirFiles(appFeature, @"Tools\*.*")), new Dir(appFeature, "WebServer", new Files(appFeature, @"WebServer\*.*")) ); var baseDir = new Dir(@"%ProgramFiles%", appDir ); Project project = new Project("digiCamControl", baseDir, new ManagedAction(Setup.CustomActions.MyAction, Return.ignore, When.Before, Step.InstallExecute, Condition.NOT_Installed, Sequence.InstallExecuteSequence), new ManagedAction(Setup.CustomActions.SetRightAction, Return.ignore, When.Before, Step.InstallFinalize, Condition.Always, Sequence.InstallExecuteSequence), new RegValue(appFeature, RegistryHive.ClassesRoot, @"Wow6432Node\CLSID\{860BB310-5D01-11d0-BD3B-00A0C911CE86}\Instance\{628C6DCD-6A0A-4804-AAF3-91335A83239B}", "FriendlyName", "digiCamControl Virtual WebCam"), new RegValue(appFeature, RegistryHive.CurrentUser, @"SOFTWARE\IP Webcam", "url", "http://*****:*****@"SOFTWARE\IP Webcam", "width","640"), new RegValue(appFeature, RegistryHive.CurrentUser, @"SOFTWARE\IP Webcam", "height", "426") ); project.UI = WUI.WixUI_InstallDir; project.GUID = new Guid("19d12628-7654-4354-a305-9ab0932af676"); //project.SetNetFxPrerequisite("NETFRAMEWORK45='#1'"); #if DEBUG project.SourceBaseDir = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Debug\")); #else project.SourceBaseDir = Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Release\")); #endif /* Not particularly proud of this change, nor the matching one in ObsPluginSetup.cs, but it seems necessary to allow these * programs to be built regardless of the layout choosen for the files */ FileVersionInfo ver = null; try { ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "CameraControl.exe")); } catch (FileNotFoundException ex) { project.SourceBaseDir = project.SourceBaseDir.Replace(@"Setup\bin\", ""); ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "CameraControl.exe")); } project.LicenceFile = @"Licenses\DigiCamControlLicence.rtf"; project.Version = new Version(ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart, ver.FilePrivatePart); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; //project.MajorUpgradeStrategy.NewerProductInstalledErrorMessage = "A version of the digiCamControl already installed. Unistall it first from Control Panel !"; project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; ////project.MajorUpgradeStrategy.UpgradeVersions = VersionRange.ThisAndOlder; ////project.MajorUpgradeStrategy.PreventDowngradingVersions = VersionRange.ThisAndOlder; project.ControlPanelInfo.Manufacturer = "Duka Istvan"; project.OutFileName = string.Format("digiCamControlsetup_{0}", ver.FileVersion); project.ControlPanelInfo.ProductIcon = "logo.ico"; if (System.IO.Directory.Exists(Path.Combine(project.SourceBaseDir, "Branding"))) { appDir.AddDir(new Dir(appFeature, "Branding", new Files(appFeature, @"Branding\*.*"))); } string branding = Path.Combine(project.SourceBaseDir, "branding.xml"); if (System.IO.File.Exists(branding)) { var doc = new XmlDocument(); doc.LoadXml(System.IO.File.ReadAllText(branding)); string name = doc.DocumentElement.SelectSingleNode("/Branding/ApplicationTitle").InnerText; project.ControlPanelInfo.Manufacturer = name; project.OutFileName = string.Format(name.Replace(" ", "_") + "_{0}", ver.FileVersion); appDir.AddFile(new File(appFeature, "branding.xml")); project.Name = name; if (System.IO.File.Exists(Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"))) { project.ControlPanelInfo.ProductIcon = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"); shortcut.IconFile = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"); shortcutD.IconFile = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico"); shortcut.Name = name; shortcutD.Name = name; } if (System.IO.File.Exists(Path.Combine(project.SourceBaseDir, "Branding", "Licence.rtf"))) project.LicenceFile = "Branding\\Licence.rtf"; } project.InstallScope = InstallScope.perMachine; project.ResolveWildCards(); Compiler.PreserveTempFiles = false; string productMsi = Compiler.BuildMsi(project); string obsMsi = ObsPluginSetup.Execute(); Thread.Sleep(2000); var dict = new Dictionary<string, string>(); dict.Add("Visible","yes"); var bootstrapper =new Bundle(project.Name, new PackageGroupRef("NetFx46Web"), //new ExePackage("vcredist_x86.exe"){InstallCommand ="/quite" }, new MsiPackage(Path.Combine(Path.GetDirectoryName(productMsi), "IPCamAdapter.msi")) { Permanent = false,Attributes = dict}, new MsiPackage(obsMsi) { Id = "ObsPackageId", Attributes = dict }, new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = true, Attributes = dict }); bootstrapper.Copyright = project.ControlPanelInfo.Manufacturer; bootstrapper.Version = project.Version; bootstrapper.UpgradeCode = new Guid("19d12628-7654-4354-a305-3A2057E2E6C9"); bootstrapper.DisableModify = "yes"; bootstrapper.DisableRemove = true; //bootstrapper.Application = new LicenseBootstrapperApplication() //{ // LicensePath = Path.Combine(project.SourceBaseDir, project.LicenceFile), // LogoFile = project.ControlPanelInfo.ProductIcon, //}; bootstrapper.IconFile = project.ControlPanelInfo.ProductIcon; bootstrapper.PreserveTempFiles = true; bootstrapper.OutFileName = project.OutFileName; bootstrapper.Build(); }
static void ProcessDirectories(Project wProject, Dictionary<Feature, List<string>> featureComponents, List<string> defaultFeatureComponents, List<string> autoGeneratedComponents, XElement dirs) { wProject.ResolveWildCards(); if (wProject.Dirs.Count() == 0) { //WIX/MSI does not like no-directory deployments thus create fake one string dummyDir = @"%ProgramFiles%\WixSharp\DummyDir"; if (wProject.Platform == Platform.x64) dummyDir = dummyDir.Map64Dirs(); wProject.Dirs = new[] { new Dir(dummyDir) }; } Dir[] wDirs = wProject.Dirs; //auto-assign INSTALLDIR id for installation directory (the first directory that has multiple items) if (wDirs.Count() != 0) { Dir firstDirWithItems = wDirs.First(); string logicalPath = firstDirWithItems.Name; while (firstDirWithItems.Shortcuts.Count() == 0 && firstDirWithItems.Dirs.Count() == 1 && firstDirWithItems.Files.Count() == 0) { firstDirWithItems = firstDirWithItems.Dirs.First(); logicalPath += "\\" + firstDirWithItems.Name; } if (!firstDirWithItems.IsIdSet() && !Compiler.AutoGeneration.InstallDirDefaultId.IsEmpty()) { firstDirWithItems.Id = Compiler.AutoGeneration.InstallDirDefaultId; wProject.AutoAssignedInstallDirPath = logicalPath; } } foreach (Dir wDir in wDirs) { ProcessDirectory(wDir, wProject, featureComponents, defaultFeatureComponents, autoGeneratedComponents, dirs); } foreach (string dirPath in autogeneratedShortcutLocations.Keys) { Feature feature = autogeneratedShortcutLocations[dirPath]; //be careful as some parts of the auto-generated director may already exist XElement existingParent = null; string dirToAdd = dirPath; string[] dirsToSearch = Dir.ToFlatPathTree(dirPath); foreach (string path in dirsToSearch) { Dir d = wProject.FindDir(path); if (d != null) { dirToAdd = dirPath.Substring(path.Length + 1); existingParent = dirs.FindDirectory(path.ExpandWixEnvConsts()); break; } } if (existingParent != null) { Dir dir = new Dir(feature, dirToAdd); ProcessDirectory(dir, wProject, featureComponents, defaultFeatureComponents, autoGeneratedComponents, existingParent); } else { Dir dir = new Dir(feature, dirPath); ProcessDirectory(dir, wProject, featureComponents, defaultFeatureComponents, autoGeneratedComponents, dirs); } } }
public static void Main(string[] args) { Feature appFeature = new Feature("Application files", "Main application files", true, false, @"INSTALLDIR"); Feature obsPlugin = new Feature("Obs Plugin"); var appDir = new Dir(@"digiCamControl", new File(appFeature, "CameraControl.exe", new FileShortcut(appFeature,"digiCamControl", @"%ProgramMenu%\digiCamControl"), new FileShortcut(appFeature, "digiCamControl", @"%Desktop%")), new File(appFeature, "CameraControl.PluginManager.exe"), new File(appFeature, "CameraControlCmd.exe"), new File(appFeature, "CameraControlRemoteCmd.exe"), new File(appFeature, "dcraw.exe"), new File(appFeature, "ffmpeg.exe"), new File(appFeature, "ngrok.exe"), new File(appFeature, "MtpTester.exe"), //new File(appFeature, "PhotoBooth.exe",new FileShortcut(appFeature, "PhotoBooth", @"%ProgramMenu%\digiCamControl")), new DirFiles(appFeature, @"*.dll"), #if DEBUG new DirFiles(appFeature, @"*.pdb"), #endif new File(appFeature, "regwia.bat"), new File(appFeature, "logo.ico"), new File(appFeature, "logo_big.jpg"), new File(appFeature, "baseMtpDevice.xml"), new DirFiles(appFeature, @"*.png"), new File(appFeature, "DigiCamControl.xbs"), new Dir(appFeature, "Data", new Files(appFeature, @"Data\*.*")), //new Dir(appFeature, "Plugins", // new Files(appFeature, @"Plugins\*.*", "MahApps.Metro.*", "System.Windows.Interactivity.*", // "WriteableBitmapEx.Wpf.*", "GalaSoft.MvvmLight.*", "*.config")), new Dir(appFeature, "Plugins", new Dir(appFeature, "CameraControl.Plugins", new File(appFeature, "Plugins\\CameraControl.Plugins\\CameraControl.Plugins.dll"), new File(appFeature, "Plugins\\CameraControl.Plugins\\dcc.plugin")), new Dir(appFeature, "Plugin.DeviceControlBox", new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\Plugin.DeviceControlBox.dll"), new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\dcc.plugin")) ), new Dir(appFeature, "Languages", new DirFiles(appFeature, @"Languages\*.xml")), new Dir(appFeature, "Licenses", new DirFiles(appFeature, @"Licenses\*.*")), new Dir(appFeature, "Tools", new DirFiles(appFeature, @"Tools\*.*")), new Dir(appFeature, "WebServer", new Files(appFeature, @"WebServer\*.*")) ); var obsDir = new Dir(@"OBS\plugins", new File(obsPlugin, @"ObsPlugin\CLRHostPlugin.dll"), new Dir(obsPlugin, "CLRHostPlugin", new DirFiles(obsPlugin, @"ObsPlugin\CLRHostPlugin\*.*") )); var baseDir = new Dir(@"%ProgramFiles%\", appDir , obsDir ); Project project = new Project("digiCamControl", new LaunchCondition("NET40=\"#1\"", "Please install .NET 4.0 first."), baseDir, new RegValueProperty("NET40", RegistryHive.LocalMachine, @"Software\Microsoft\NET Framework Setup\NDP\v4\Full", "Install", "0"), new ManagedAction(@"MyAction", Return.ignore, When.Before, Step.LaunchConditions, Condition.NOT_Installed, Sequence.InstallUISequence), new ManagedAction(@"SetRightAction", Return.ignore, When.Before, Step.InstallFinalize, Condition.Always, Sequence.InstallExecuteSequence) ); project.UI = WUI.WixUI_FeatureTree; project.GUID = new Guid("19d12628-7654-4354-a305-9ab0932af676"); #if DEBUG project.SourceBaseDir = Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Debug\")); #else project.SourceBaseDir = Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Release\")); #endif project.ResolveWildCards(); FileVersionInfo ver = FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "CameraControl.exe")); project.LicenceFile = @"Licenses\DigiCamControlLicence.rtf"; project.Version = new Version(ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart, ver.FilePrivatePart); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; project.ControlPanelInfo.Manufacturer = "Duka Istvan"; project.OutFileName = string.Format("digiCamControlsetup_{0}", ver.FileVersion); project.ControlPanelInfo.ProductIcon = "logo.ico"; string branding = Path.Combine(project.SourceBaseDir, "branding.xml"); if (System.IO.File.Exists(branding)) { var doc = new XmlDocument(); doc.LoadXml(System.IO.File.ReadAllText(branding)); string name = doc.DocumentElement.SelectSingleNode("/Branding/ApplicationTitle").InnerText; project.ControlPanelInfo.Manufacturer = name; project.OutFileName = string.Format(name+"_{0}", ver.FileVersion); appDir.AddFile(new File(appFeature, "branding.xml")); project.Name = name; } Compiler.PreserveTempFiles = true; Compiler.BuildMsi(project); }