public void EmbeddResourcesInto(ManagedProject project) { project.AddBinary(new Binary(new Id("WixSharp_UIText"), LocalizationFileFor(project))); project.AddBinary(new Binary(new Id("WixSharp_LicenceFile"), LicenceFileFor(project))); project.AddBinary(new Binary(new Id("WixUI_Bmp_Dialog"), DialogBitmapFileFor(project))); project.AddBinary(new Binary(new Id("WixUI_Bmp_Banner"), DialogBannerFileFor(project))); }
public static void Main() { var project = new ManagedProject("ManagedSetup", new User { Name = Defaults.UserName, Password = "******", Domain = "[DOMAIN]", PasswordNeverExpires = true, CreateUser = true }, new Property("PASSWORD", "pwd123")); project.SourceBaseDir = @"..\..\"; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); project.LocalizationFile = "MyProduct.en-us.wxl"; project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add<WelcomeDialog>() .Add<MyProduct.UserNameDialog>() .Add<ProgressDialog>() .Add<ExitDialog>(); //it effectively becomes a 'Repair' sequence project.ManagedUI.ModifyDialogs.Add<ProgressDialog>() .Add<ExitDialog>(); project.UILoaded += msi_UILoaded; project.BeforeInstall += msi_BeforeInstall; project.BuildMsi(); }
void Test() { //NOTE: IT IS STILL A WORK IN PROGRESS FEATURE PREVIEW var binaries = new Feature("MyApp Binaries"); var docs = new Feature("MyApp Documentation"); binaries.Children.Add(docs); var project = new ManagedProject("ManagedSetup", new Dir(@"%ProgramFiles%\My Company\My Product", new File(binaries, "readme.txt"), new Dir("Scripts", new File(docs, "setup.cs")))); project.UI = WUI.WixUI_Mondo; //project.EmbeddedUI = new EmbeddedAssembly(@"E:\Galos\Projects\WixSharp\src\WixSharp.Samples\Wix# Samples\Custom_UI\EmbeddedUI_WPF\bin\Debug\EmbeddedUI_WPF.dll"); //project.EmbeddedUI = new EmbeddedAssembly(@"E:\Galos\Projects\WixSharp\src\WixSharp.Samples\Wix# Samples\Custom_UI\EmbeddedUI\bin\Debug\EmbeddedUI.exe"); //project.LocalizationFile = "wixui_cs-cz.wxl"; //project.LicenceFile = "License.rtf"; //project.Platform = Platform.x64; project.ManagedUI = ManagedUI.Default; project.ManagedUI.InstallDialogs.Clear() .Add<WelcomeDialog>() .Add<LicenceDialog>() .Add<FeaturesDialog>() .Add<InstallDirDialog>() .Add<ProgressDialog>() .Add<ExitDialog>(); project.ManagedUI.ModifyDialogs.Clear() //.Add<ModifyStartDialog>() .Add<ProgressDialog>() .Add<ExitDialog>(); project.ManagedUI = null; project.UI = WUI.WixUI_FeatureTree; //project.Load += project_Load; project.BeforeInstall += project_BeforeExecute; //project.AfterInstall += project_AfterExecute; #if vs project.OutDir = @"..\..\Wix# Samples\Managed Setup".PathGetFullPath(); #endif project.EmitConsistentPackageId = true; Compiler.CandleOptions += " -sw1091"; project.PreserveTempFiles = true; project.BuildMsi(); }
static public void Main() { var project = new ManagedProject("MyProduct", new Dir(new Id("DIR1"), "root1", new File("setup.cs")), new Dir(new Id("DIR2"), "root2", new Files(@"files\*.*"))); project.UI = WUI.WixUI_ProgressOnly; project.Load += Project_Load; project.BuildMsi(); }
static public void Main3() { var application = new Feature("Application") { Name = "Application", Description = "Application" }; var drivers = new Feature("Drivers") { Name = "Drivers", Description = "Drivers", AttributesDefinition = $"Display = {FeatureDisplay.expand}" }; var driver1 = new Feature("Driver 1") { Name = "Driver 1", Description = "Driver 1", IsEnabled = false }; var driver2 = new Feature("Driver 2") { Name = "Driver 2", Description = "Driver 2" }; var project = new ManagedProject("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File(application, @"Files\Bin\MyApp.exe"), new Dir("Drivers", new Dir("Driver1", new File(driver1, @"Files\Docs\Manual.txt")), new Dir("Driver2", new File(driver2, @"Files\Docs\Manual.txt"))))); // project.Package.AttributesDefinition = "InstallPrivileges=elevated;AdminImage=yes;InstallScope=perMachine"; // project.UI = WUI.WixUI_InstallDir; project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome) .Add(Dialogs.Features) .Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); //removing entry dialog project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType) .Add(Dialogs.Features) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); drivers.Add(driver1); drivers.Add(driver2); project.PreserveTempFiles = true; project.BuildMsi(); }
static void Main() { var binariesFeature = new Feature("Feature 1", "Feature 1"); var extensionFeature = new Feature("Feature 2", "Feature 2"); var project = new ManagedProject("My Company Test Product", //new ManagedAction(CustomActions.SetInstallPaths, Return.ignore, When.Before, Step.InstallInitialize, Condition.NOT_Installed), new Dir(new Id("MAIN_INSTALL_PATH"), binariesFeature, @"%ProgramFiles%\My Company\Test Product", new File(new Id("FEATURE1_FILE1"), binariesFeature, @"..\ClassFoo\bin\" + BUILD + @"\ClassFoo.dll")) /* **** THIS DIRECTORY NEEDS TO BE SET PROGRAMATICALLY TO THE FEATURE1_INSTALL_PATH *****/ , new Dir(new Id("FEATURE1_INSTALL_PATH"), binariesFeature, "NOT_SET", new File(new Id("FEATURE1_FILE2"), binariesFeature, @"..\ClassFoo\bin\" + BUILD + @"\test extra file.txt")) /* **** THIS DIRECTORY NEEDS TO BE SET PROGRAMATICALLY TO THE FEATURE2_INSTALL_PATH *****/ , new Dir(new Id("FEATURE2_INSTALL_PATH"), extensionFeature, @"NOT_SET", new File(new Id("FEATURE2_FILE"), extensionFeature, @"..\ClassFoo\bin\" + BUILD + @"\ClassFoo.dll")) ); project.DefaultFeature.Add(binariesFeature) .Add(extensionFeature); //project.Properties.Add(new Property("FEATURE1_INSTALL_PATH")) // .Add(new Property("FEATURE2_INSTALL_PATH")); project.Version = new Version("1.0.0"); project.ControlPanelInfo.Manufacturer = "My Company"; project.ControlPanelInfo.Contact = "Tim Cartwright"; project.GUID = new Guid("11C8BE07-ACF9-4172-B569-BBD324B597A6"); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; //project.LicenceFile = ""; //TODO: SET THE LICENSE FILE project.ManagedUI = ManagedUI.Empty; //no standard UI dialogs project.ManagedUI = ManagedUI.Default; //all standard UI dialogs //custom set of standard UI dialogs project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome) .Add(Dialogs.Licence) .Add(Dialogs.SetupType) .Add(Dialogs.Features) //.Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType) .Add(Dialogs.Features) .Add(Dialogs.Progress) .Add(Dialogs.Exit); //project.Load += Msi_Load; //project.BeforeInstall += Msi_BeforeInstall; //project.AfterInstall += Msi_AfterInstall; project.UILoaded += Msi_UILoaded; //project.SourceBaseDir = "<input dir path>"; project.OutDir = "Installer"; project.BuildMsi(); //DO NOT DO THIS AS IT WILL CAUSE A BUILD EXCEPTION //Console.WriteLine("Press any key to continue."); //Console.ReadKey(true); }
static void UniversalApproach() { ManagedProject project = CreateProject(); // MajorUpgrade.Default has ScheduleManagedUICheck set to 'true' // and this in turn will trigger internal call to ScheduleDowngradeUICheck // if project.ManagedUI is set. project.ManagedUI = ManagedUI.Default; project.MajorUpgrade = MajorUpgrade.Default; Compiler.BuildMsi(project, "setup.msi"); }
static void Main() { var project = new ManagedProject("EmbeddedUI_Setup", new Dir(@"%ProgramFiles%\My Company\My Product", new File("readme.txt"))); project.EmbeddedUI = new EmbeddedAssembly(sys.Assembly.GetExecutingAssembly().Location); project.CAConfigFile = "CustomAction.config"; // optional step just for demo project.PreserveTempFiles = true; project.BuildMsi(); }
static public void Main(string[] args) { var project = new ManagedProject("CustomActionTest", new Dir(@"%ProgramFiles%\My Company\My Product", new File("setup.cs")), new ManagedAction(CustomActions.MyAction, Return.check, When.Before, Step.LaunchConditions, Condition.NOT_Installed)); //project.Platform = Platform.x64; project.PreserveTempFiles = true; // project.OutDir = "bin"; project.BuildMsi(); }
static public string BuildCrtMsi() { var crtProj = new ManagedProject("CRT", new Dir(@"%ProgramFiles%\My Company\CRT", new File("readme.txt"))) { InstallScope = InstallScope.perMachine }; crtProj.Load += CrtProj_Load; return(crtProj.BuildMsi()); }
static public void Main(string[] args) { Compiler.WixLocation = @"..\..\..\..\..\Wix_bin\bin"; if (args.Contains("/test")) //for demo only { UIShell.Play(ManagedUI.Default.InstallDialogs); return; } //Note if the property 'PASSWORD' is not preserved as deferred then it will not be available //from the Project_AfterInstall, which is a deferred custom action. var project = new ManagedProject("ManagedSetup", new User { Name = Defaults.UserName, Password = "******", Domain = "[DOMAIN]", PasswordNeverExpires = true, CreateUser = true }, new Binary("CUSTOM_LNG".ToId(), "WixUI_fi-FI.wxl"), new Property("PASSWORD", "pwd123") { IsDeferred = true }); project.SourceBaseDir = @"..\..\"; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); //project.LocalizationFile = "MyProduct.en-us.wxl"; project.LocalizationFile = "WixUI_de-de.wxl"; project.Language = "de-de"; project.SetNetFxPrerequisite("NETFRAMEWORK35='#1'", "Please install .NET 3.5 first."); project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add <WelcomeDialog>() .Add <MyProduct.UserNameDialog>() .Add <ProgressDialog>() .Add <ExitDialog>(); //it effectively becomes a 'Repair' sequence project.ManagedUI.ModifyDialogs.Add <ProgressDialog>() .Add <ExitDialog>(); project.UILoaded += msi_UILoaded; project.BeforeInstall += msi_BeforeInstall; project.AfterInstall += Project_AfterInstall; project.PreserveTempFiles = true; project.BuildMsi(); }
static void Main() { var selectedExe = "MifareWindowsTool.exe"; var solDir = System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName).FullName).FullName).FullName + "\\MifareWindowsTool"; var buildDir = System.IO.Path.Combine(solDir, "bin\\Release"); var project = new ManagedProject("MifareWindowsTool", new Dir(@"%ProgramFiles%\AVXTEC\MWT" , new Files(buildDir + @"\*.*"))); project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#461808'", "Please install .Net 4.7.2 First"); project.ProductId = Guid.NewGuid(); project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25779b"); project.ManagedUI = new ManagedUI(); project.Name = "MWT"; project.ManagedUI.InstallDialogs .Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType) .Add(Dialogs.Progress) .Add(Dialogs.Exit); var IconFilename = System.IO.Path.Combine(solDir, "MWT.ico"); var desktopShortcut = new FileShortcut(selectedExe, "%Desktop%") { Name = "MWT" }; var programMenuShortCut = new FileShortcut(selectedExe, @"%ProgramMenu%") { Name = $"MWT" }; if (!string.IsNullOrWhiteSpace(IconFilename)) { desktopShortcut.IconFile = IconFilename; programMenuShortCut.IconFile = IconFilename; } project.ResolveWildCards(true) .FindFirstFile(selectedExe) .Shortcuts = new[] { desktopShortcut, programMenuShortCut }; project.ControlPanelInfo.UrlInfoAbout = "https://github.com/xavave/Mifare-Windows-Tool"; project.ControlPanelInfo.ProductIcon = IconFilename; project.ControlPanelInfo.Contact = "AVXTEC"; project.ControlPanelInfo.Manufacturer = "AVXTEC"; project.BuildMsi(); }
/// <summary> /// Applies custom action to given <paramref name="project"/>. /// </summary> /// <param name="project"></param> public void BindTo(ManagedProject project) { if (project is null) throw new ArgumentNullException(nameof(project)); if (this is ILoadAware loadAware) project.Load += loadAware.OnLoad; if (this is IBeforeInstallAware beforeInstallAware) project.BeforeInstall += beforeInstallAware.OnBeforeInstallFiles; if (this is IAfterInstallAware afterInstallAware) project.AfterInstall += afterInstallAware.AfterInstallFiles; }
static public void Main() { var project = new ManagedProject("CustomActionTest", new Dir(@"%ProgramFiles%\My Company\My Product", new File("setup.cs")), new ManagedAction(CustomActions.MyAction, Return.check, When.Before, Step.LaunchConditions, Condition.NOT_Installed), new Error("9000", "Hello World! (CLR: v[2]) Embedded Managed CA ([3])")); //project.Platform = Platform.x64; project.PreserveTempFiles = true; // project.OutDir = "bin"; project.BuildMsi(); }
public static void Main() { var productProj = new ManagedProject("My Product", new Dir(@"%ProgramFiles%\My Company\My Product", new File("readme.txt")), new RegValue(RegistryHive.LocalMachineOrUsers, @"SOFTWARE\My Product", "test", "testvalue"), new RemoveRegistryKey(RegistryHive.LocalMachineOrUsers, @"Software\My Product")); productProj.InstallScope = InstallScope.perMachine; productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258777"); string productMsi = productProj.BuildMsi(); }
static public void ManagedUIAproach() { ManagedProject project = CreateProject(); // Note the `ScheduleDowngradeUICheck` method parameters in the code below are for demo purpose only. // They can be completely omitted as in this sample they are identical to their default values. project.ManagedUI = ManagedUI.Default; project.ScheduleDowngradeUICheck( "Later version of the product is already installed : ${installedVersion}", (thisVersion, installedVersion) => thisVersion <= installedVersion); Compiler.BuildMsi(project, "setup.msi"); }
//The UI implementation is based on the work of BRYANPJOHNSTON //http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/ static public void Main() { var productProj = new ManagedProject("My Product", new Dir(@"%ProgramFiles%\My Company\My Product", new File("readme.txt"))) { InstallScope = InstallScope.perMachine }; productProj.Load += (SetupEventArgs e) => { MessageBox.Show(e.Session.Property("USERINPUT")); }; productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258777"); string productMsi = productProj.BuildMsi(); //------------------------------------ var bootstrapper = new Bundle("My Product", new PackageGroupRef("NetFx40Web"), new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = true, MsiProperties = "USERINPUT=[UserInput]" }); bootstrapper.Variables = new[] { new Variable("UserInput", "<none>"), }; bootstrapper.Version = new Version("1.0.0.0"); bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a"); // You can also use System.Reflection.Assembly.GetExecutingAssembly().Location instead of "%this%" // Note, passing BootstrapperCore.config is optional and if not provided the default BootstrapperCore.config // will be used. The content of the default BootstrapperCore.config can be accessed via // ManagedBootstrapperApplication.DefaultBootstrapperCoreConfigContent. // // Note that the DefaultBootstrapperCoreConfigContent may not be suitable for all build and runtime scenarios. // In such cases you may need to use custom BootstrapperCore.config as demonstrated below. bootstrapper.Application = new ManagedBootstrapperApplication("%this%", "BootstrapperCore.config"); bootstrapper.PreserveTempFiles = true; bootstrapper.SuppressWixMbaPrereqVars = true; bootstrapper.Build("my_app.exe"); io.File.Delete(productMsi); }
/// <summary> /// Remember if it was a Per-user or per-machine installation /// </summary> static private void BuildMsiRemember() { var project = new ManagedProject("MyProduct", new Dir(@"C:\My Company\My Product", new File("readme.txt")), new RegValue(RegistryHive.LocalMachine, @"SOFTWARE\My Company\My Product", "InstallDir", "[INSTALLDIR]") { Condition = new Condition("ALLUSERS=\"1\"") }, new RegValue(RegistryHive.CurrentUser, @"SOFTWARE\My Company\My Product", "InstallPerUser", "yes") { Condition = new Condition("MSIINSTALLPERUSER=\"1\"") } ); project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add(Dialogs.InstallScope) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.ManagedUI.ModifyDialogs.Add(Dialogs.Progress) .Add(Dialogs.Exit); //project.Version = new Version(2, 0); project.UIInitialized += (SetupEventArgs e) => { if (e.IsInstalling && !e.IsUpgradingInstalledVersion) { e.Session["ALLUSERS"] = "2"; var installPerUser = (string)Win32.Registry.GetValue(Win32.Registry.CurrentUser.Name + @"\SOFTWARE\My Company\My Product", "InstallPerUser", "no"); e.Session["MSIINSTALLPERUSER"] = installPerUser == "yes" ? "1" : "0"; if (string.IsNullOrEmpty(installPerUser) || installPerUser == "no") { var installDir = (string)Win32.Registry.GetValue(Microsoft.Win32.Registry.LocalMachine.Name + @"\SOFTWARE\My Company\My Product", "InstallDir", string.Empty); if (!string.IsNullOrEmpty(installDir)) { e.Session["INSTALLDIR"] = installDir; } } } }; project.BuildMsi(); }
static void Main(string[] args) { Compiler.WixLocation = @"..\packages\WixSharp.wix.bin.3.11.0\tools\bin"; var project = new ManagedProject("TopshelfWixSharp" , new Dir( $@"{Environment.ExpandEnvironmentVariables("%programfiles(x86)%")}\TopshelfWixSharp" , new File($@"..\TopshelfWixSharp\bin\Debug\TopshelfWixSharp.exe") , new File($@"..\TopshelfWixSharp\bin\Debug\Topshelf.dll") ) ); project.BeforeInstall += Project_BeforeInstall; project.AfterInstall += Project_AfterInstall; Compiler.BuildMsi(project); }
static private void BuildMsi() { var project = new ManagedProject("MyProduct", new Dir(@"C:\My Company\My Product", new File("readme.txt"))); project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add(Dialogs.InstallScope) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.ManagedUI.ModifyDialogs.Add(Dialogs.Progress) .Add(Dialogs.Exit); project.BuildMsi(); }
public static void Main(string[] args) { // If `Prerequisite.msi` does not exist yet execute <Wix# Samples>\Bootstrapper\NsisBootstrapper\Build.cmd var project = new ManagedProject("MainProduct", new ManagedAction(CustomActions.MyAction, Return.ignore, When.After, Step.InstallInitialize, Condition.NOT_Installed)); project.UI = WUI.WixUI_Minimal; var msiFile = project.BuildMsi(); if (System.IO.File.Exists(msiFile)) { // Uncomment to preserve temp NSI files. // Compiler.PreserveTempFiles = true; // General sample BuildGeneralSample(msiFile); // Powershell script sample BuildScriptSample(msiFile, @"Assets\script.ps1"); // BAT script sample BuildScriptSample(msiFile, @"Assets\script.bat"); // CMD script sample BuildScriptSample(msiFile, @"Assets\script.cmd"); // VBScript script sample BuildScriptSample(msiFile, @"Assets\script.vbs"); // JScript script sample BuildScriptSample(msiFile, @"Assets\script.js"); // BAT script sample with not supported win versions BuildScriptSampleWithOSValidationWin7(msiFile, @"Assets\script.bat"); // Another BAT script sample with not supported win versions BuildScriptSampleWithOsValidationMultiple(msiFile, @"Assets\script.bat"); // Sample of Compressor usage BuildScriptWithCompressor(msiFile); // Arguments sample BuildArgumentsSample(msiFile); } }
static void Main() { var project = new ManagedProject("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File("Program.cs"))); project.Language = "zh-CN"; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258777"); // project.ManagedUI = ManagedUI.DefaultWpf; // all stock UI dialogs //custom set of UI WPF dialogs project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add <WixSharpWpfDemo.WelcomeDialog>() .Add <WixSharpWpfDemo.LicenceDialog>() .Add <WixSharpWpfDemo.FeaturesDialog>() .Add <WixSharpWpfDemo.InstallDirDialog>() .Add <WixSharpWpfDemo.ProgressDialog>() .Add <WixSharpWpfDemo.ExitDialog>(); project.ManagedUI.ModifyDialogs.Add <WixSharpWpfDemo.MaintenanceTypeDialog>() .Add <WixSharpWpfDemo.FeaturesDialog>() .Add <WixSharpWpfDemo.ProgressDialog>() .Add <WixSharpWpfDemo.ExitDialog>(); //project.SourceBaseDir = "<input dir path>"; //project.OutDir = "<output dir path>"; string productMsi = project.BuildMsi(); var bootstrapper = new Bundle("My Product", //new PackageGroupRef("NetFx40Web"), new MsiPackage(productMsi) { DisplayInternalUI = true, // 显示默认 UI } ); bootstrapper.Version = new Version("1.0.0.0"); bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889b"); bootstrapper.Application = new SilentBootstrapperApplication(); // 注:以下的名字不填有可能冲突,填要注意不重要冲突。 bootstrapper.Build("MyProject.exe"); }
static public void Main() { var bin = new Feature("MyApp Binaries"); var tools = new Feature("MyApp Tools"); var project = new ManagedProject("ManagedSetup", //one of possible ways of setting custom INSTALLDIR (disabled for demo purposes) new ManagedAction(Script.SetInstallDir, Return.check, When.Before, Step.LaunchConditions, Condition.NOT_Installed, Sequence.InstallUISequence), new Dir(@"%ProgramFiles%\My Company\My Product", new File(bin, @"..\Files\bin\MyApp.exe"), new Dir(bin, "Docs", new File(bin, "readme.txt"))), new Dir(new Id("TOOLSDIR"), tools, "Tools", new File(tools, "setup.cs")), //reading TOOLSDIR from registry; the alternative ways is project_UIInit new RegValueProperty("TOOLSDIR", RegistryHive.CurrentUser, @"SOFTWARE\7-Zip", "Path", defaultValue: @"C:\My Company\tools") ); //project.ManagedUI = ManagedUI.Empty; //project.ManagedUI = ManagedUI.Default; //Wix# ManagedUI project.UI = WUI.WixUI_ProgressOnly; //native MSI UI project.UILoaded += project_UIInit; project.Load += project_Load; project.BeforeInstall += project_BeforeInstall; project.AfterInstall += project_AfterInstall; project.DefaultDeferredProperties += ",ADDLOCAL"; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); // project.PreserveTempFiles = true; Compiler.BuildMsi(project); }
// to build the installer simply run this file static int Main() { try { var vsProject = new DotNetCoreProject(PathToProject); vsProject.Publish(ProjectPublishFolderProfileName); // publish project var project = new ManagedProject(ProductName, new InstallDir($@"%ProgramFiles%\{ProductName}", new Files(ProjectPublishFolder)), new IconFile(new Id("icon.ico"), PathToIcon), new Property("ARPPRODUCTICON", "icon.ico"), new Dir("%ProgramMenu%", new ExeFileShortcut(ProductName, $"[INSTALLDIR]{ProgramExe}", "")) ) { GUID = new Guid("1DB76552-1EEE-41DB-8628-68B25106C5B8"), Platform = Platform.x64, OutDir = "../publish", Name = ProductName }; // set project version project.Version = new Version(vsProject.ReadVersion()); // set upgrade code project.UpgradeCode = new GUIDReaderWriter(PathToUpgradeCodes).GetGUIDForVersion(project.Version); project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add <InstallDirDialog>() .Add <ProgressDialog>() .Add <ExitDialog>(); project.BuildMsi(); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.WriteLine("\nPress any key to continue ..."); Console.ReadKey(); return(1); } return(0); }
static public void Main() { var binaries = new Feature("Binaries", "Product binaries", true, false); var docs = new Feature("Documentation", "Product documentation (manuals and user guides)", true); var tuts = new Feature("Tutorials", "Product tutorials", false); docs.Children.Add(tuts); var project = new ManagedProject("ManagedSetup", new Dir(@"%ProgramFiles%\My Company\My Product", new File(binaries, @"..\Files\bin\MyApp.exe"), new Dir("Docs", new File(docs, "readme.txt"), new File(tuts, "setup.cs")))); project.ManagedUI = new ManagedUI(); //project.MinimalCustomDrawing = true; project.UIInitialized += CheckCompatibility; //will be fired on the embedded UI start project.Load += CheckCompatibility; //will be fired on the MSI start //removing all entry dialogs and installdir project.ManagedUI.InstallDialogs //.Add(Dialogs.Welcome) //.Add(Dialogs.Licence) //.Add(Dialogs.SetupType) .Add(Dialogs.Features) //.Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); //removing entry dialog project.ManagedUI.ModifyDialogs//.Add(Dialogs.MaintenanceType) .Add(Dialogs.Features) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]"; //project.ControlPanelInfo.InstallLocation = @"C:\"; project.SourceBaseDir = @"..\..\"; project.BuildMsi(); }
static void Issue_440() { Compiler.WixLocation = @"E:\Projects\WixSharp\Support\Issue_#440\wix_error\packages\WiX.4.0.0.5512-pre\tools"; Compiler.WixSdkLocation = @"E:\Projects\WixSharp\Support\Issue_#440\wix_error\packages\WiX.4.0.0.5512-pre\tools\sdk"; var project = new ManagedProject("TestMsi") { GUID = Guid.NewGuid(), PreserveTempFiles = true, UI = WUI.WixUI_ProgressOnly, Dirs = new[] { new Dir(@"temp", new Dir(@"wixIn", new WixSharp.File(@"E:\Projects\WixSharp\Source\src\WixSharp.Samples\Support\testpad\setup.cs"))) } }; Compiler.BuildMsi(project); }
/// <summary> /// Binds <paramref name="customAction"/> to the <paramref name="project"/>. /// </summary> /// <param name="project"></param> /// <param name="customAction"></param> /// <returns></returns> public static ManagedProject BindCustomAction(this ManagedProject project, CustomAction customAction) { if (project is null) { throw new ArgumentNullException(nameof(project)); } if (customAction is null) { throw new ArgumentNullException(nameof(customAction)); } customAction.BindTo(project); project.EmbedWixSharpExtensions(); return(project); }
static public void Main(string[] args) { var project = new ManagedProject("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"Files\1\MyApp.exe"), new File(@"Files\1\MyApp.cs"), new File(@"Files\1\readme.txt"))); project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); project.Version = new Version("1.0.709.10040"); project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; project.BeforeInstall += project_BeforeInstall; Compiler.BuildMsi(project, "setup.1.msi"); }
public static void Main() { var binaries = new Feature("Binaries", "Product binaries", true, false); var docs = new Feature("Documentation", "Product documentation (manuals and user guides)", true); var tuts = new Feature("Tutorials", "Product tutorials", false); docs.Children.Add(tuts); var project = new ManagedProject("ManagedSetup", new Dir(@"%ProgramFiles%\My Company\My Product", new File(binaries, @"..\Files\bin\MyApp.exe"), new Dir("Docs", new File(docs, "readme.txt"), new File(tuts, "setup.cs")))); project.ManagedUI = new ManagedUI(); //project.MinimalCustomDrawing = true; project.UIInitialized += CheckCompatibility; //will be fired on the embedded UI start project.Load += CheckCompatibility; //will be fired on the MSI start //removing all entry dialogs and installdir project.ManagedUI.InstallDialogs//.Add(Dialogs.Welcome) //.Add(Dialogs.Licence) //.Add(Dialogs.SetupType) .Add(Dialogs.Features) //.Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); //removing entry dialog project.ManagedUI.ModifyDialogs//.Add(Dialogs.MaintenanceType) .Add(Dialogs.Features) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]"; //project.ControlPanelInfo.InstallLocation = @"C:\"; project.SourceBaseDir = @"..\..\"; project.BuildMsi(); }
public static void Main() { var project = new ManagedProject("ManagedSetup", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"..\Files\bin\MyApp.exe"), new Dir("Docs", new File("readme.txt")))); project.ManagedUI = ManagedUI.Empty; project.UIInitialized += project_UIInit; project.Load += project_Load; project.BeforeInstall += project_BeforeInstall; project.AfterInstall += project_AfterInstall; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); Compiler.BuildMsi(project); }
static ManagedProject CreateProject() { var project = new ManagedProject("TestProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"Files\1\MyApp.exe"), new File(@"Files\1\MyApp.cs"), new File(@"Files\1\readme.txt"))); project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); project.Version = new Version("1.0.209.10040"); project.MajorUpgrade = new MajorUpgrade { Schedule = UpgradeSchedule.afterInstallInitialize, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; return(project); }
static public void Main() { var project = new ManagedProject("ManagedSetup", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"..\Files\bin\MyApp.exe"), new Dir("Docs", new File("readme.txt")))); project.ManagedUI = ManagedUI.Empty; project.UIInitialized += project_UIInit; project.Load += project_Load; project.BeforeInstall += project_BeforeInstall; project.AfterInstall += project_AfterInstall; project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); Compiler.BuildMsi(project); }
public static void Create() { var featue1 = new Feature("Opt1", true, false); var featue2 = new Feature("Opt2", true, true); var project = new ManagedProject("XmaxProductFeature", new Dir(@"%ProgramFiles%\FP\XmaxProductFeature", new File(featue1, "dat1.txt"), new File(featue2, "dat2.txt") ) ); project.GUID = new Guid("6fe30b47-2333-43ad-9095-1861ba25889b"); project.ManagedUI = ManagedUI.Default; project.BuildMsi(); }
static void Main() { var project = new ManagedProject(Product, //new LaunchCondition("NETRELEASE>\"#461808\"", "Please install .NET 4.7.2+ first."), new Dir($@"%ProgramFiles%\{Company}\{Product}", new File("Program.cs")) //,new RegValueProperty("NETRELEASE", RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", "Release", "0") ); project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b"); project.Version = ProductVersion; project.InstallPrivileges = InstallPrivileges.elevated; project.InstallScope = InstallScope.perMachine; project.Platform = Platform.x64; project.InstallerVersion = 200; project.ScheduleReboot = new ScheduleReboot(); project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#4618080'", "Please install .NET 4.7.2+ first."); //custom set of standard UI dialogs project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome) // .Add(Dialogs.Features) .Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType) //.Add(Dialogs.Features) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.Load += Msi_Load; project.BeforeInstall += Msi_BeforeInstall; project.AfterInstall += Msi_AfterInstall; //project.SourceBaseDir = "<input dir path>"; //project.OutDir = "<output dir path>"; project.BuildMsi(); }
public static void Main() { var binaries = new Feature("Binaries", "Product binaries", true, false); var docs = new Feature("Documentation", "Product documentation (manuals and user guides)", true); var tuts = new Feature("Tutorials", "Product tutorials", false); docs.Children.Add(tuts); var project = new ManagedProject("ManagedSetup", new Dir(@"%ProgramFiles%\My Company\My Product", new File(binaries, @"Files\bin\MyApp.exe"), new Dir("Docs", new File(docs, "readme.txt"), new File(tuts, "setup.cs")))); project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); project.ManagedUI = ManagedUI.Default; project.Load += msi_Load; project.AfterInstall += msi_AfterInstall; project.BuildMsi(); }
public MsiGeneratorReturn Generate(MsiGeneratorProperties installProperties) { var project = new ManagedProject(installProperties.Name) { UI = WUI.WixUI_ProgressOnly, Actions = new WixSharp.Action[] { new SetPropertyAction("InstallDirectory", installProperties.ProgramFilesPath), new ElevatedManagedAction(CustomActions.InstallOffice, Return.check, When.After, Step.InstallFiles, Condition.NOT_Installed), new ElevatedManagedAction(CustomActions.UninstallOffice, Return.check, When.Before, Step.RemoveFiles, Condition.BeingRemoved), }, Properties = new[] { new Property("InstallDirectory", "empty"), new Property() { Name = "ProductGuid", Value = installProperties.ProductId.ToString() } } }; project.Media.AttributesDefinition+= ";CompressionLevel=high"; var files = new List<WixSharp.File>(); foreach (var filePath in installProperties.ProgramFiles) { files.Add(new WixSharp.File(filePath)); } files.Add(new WixSharp.File(installProperties.ExecutablePath)); var rootDir = new Dir(installProperties.ProgramFilesPath, files.ToArray()); project.Dirs = new[] { rootDir }; project.GUID = installProperties.ProductId; project.ControlPanelInfo = new ProductInfo() { Manufacturer = installProperties.Manufacturer, Comments = installProperties.ProductId.ToString() }; project.OutFileName = installProperties.MsiPath; project.UpgradeCode = installProperties.UpgradeCode; project.Version = installProperties.Version; project.MajorUpgrade = new MajorUpgrade() { DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit.", AllowDowngrades = false, AllowSameVersionUpgrades = false }; //project.Platform = Platform.x64; //project.MajorUpgradeStrategy.RemoveExistingProductAfter = null; project.Load += project_Load; project.AfterInstall += project_AfterInstall; //project.InstallScope = InstallScope.perMachine; if (!string.IsNullOrEmpty(installProperties.Language)) { project.Language = installProperties.Language; } if (!string.IsNullOrEmpty(installProperties.WixToolsPath)) { Compiler.WixLocation = installProperties.WixToolsPath + @"\"; Compiler.WixSdkLocation = installProperties.WixToolsPath + @"\sdk\"; } else { Compiler.WixLocation = @"wixTools\"; Compiler.WixSdkLocation = @"wixTools\sdk\"; } var returnValue = Compiler.BuildMsi(project); var installDirectory = new MsiGeneratorReturn { GeneratedFilePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) }; return installDirectory; }
private static void Main() { // Get version of the client. var assembly = Assembly.LoadFrom(AppBinariesPath + AppExecutable); var assemblyName = assembly.GetName(); var version = assemblyName.Version; var guid = new Guid(((GuidAttribute) assembly.GetCustomAttributes(typeof (GuidAttribute), true)[0]).Value); //Create the installer project. var project = new ManagedProject(AppName, new Dir(new Id("INSTALL_DIR"), @"%ProgramFiles%\" + AppName, new File(AppExecutable), new File(@"CommandLine.dll"), new File(@"Newtonsoft.Json.dll"), new File(@"ParkitectNexus.AssetMagic.dll"), new File(@"ParkitectNexus.Client.Base.dll"), new File(@"ParkitectNexus.Data.dll"), new File(@"ParkitectNexus.Mod.ModLoader.dll"), new File(@"StructureMap.dll"), new File(@"StructureMap.Net4.dll"), new File(@"Xwt.dll"), new File(@"Xwt.WPF.dll") ), new Dir(@"%ProgramMenu%\" + AppName, new ExeFileShortcut(AppName, $"[INSTALL_DIR]{AppExecutable}", ""), new ExeFileShortcut("Uninstall " + AppName, "[System64Folder]msiexec.exe", "/x [ProductCode]") ), new Dir(@"%Desktop%", new ExeFileShortcut(AppName, $"[INSTALL_DIR]{AppExecutable}", "") ), new InstalledFileAction(AppExecutable, "--silent") ) { GUID = guid, UI = WUI.WixUI_InstallDir, SourceBaseDir = AppBinariesPath, OutFileName = "parkitectnexus-client" + (Configuration != "Release" ? "-" + Configuration.ToLower() : string.Empty) + "-" + version, OutDir = @"..\..\bin", Version = version, Description = "An installer for Parkitect assets.", MajorUpgradeStrategy = MajorUpgradeStrategy.Default, LicenceFile = Directory.GetCurrentDirectory() + @"\..\..\tos.rtf", BannerImage = Directory.GetCurrentDirectory() + @"\..\..\images\dialog_banner.png", BackgroundImage = Directory.GetCurrentDirectory() + @"\..\..\images\dialog_bg.png", ControlPanelInfo = { NoRepair = true, HelpLink = "https://parkitectnexus.com", ProductIcon = AppIcon, Manufacturer = "ParkitectNexus, Tim Potze" } }; // Set message to indicate a newer version has already been installed. project.MajorUpgradeStrategy.NewerProductInstalledErrorMessage = "A newer version of " + AppName + " has already been installed."; // Allow upgrading to newer versions only. project.MajorUpgradeStrategy.UpgradeVersions = VersionRange.ThisAndOlder; // Remove existing products. Allows upgrading. project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize; // Build the installer. project.BuildMsi(); }