using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using WixSharp;
using WixSharp.CommonTasks;
using WixToolset.Dtf.WindowsInstaller;
namespace Sai.RvKits_Setup
{
public class Program
{
static void Main()
{
var baseFeature = new Feature("必要组件", "加载插件的必须组件") { Display = FeatureDisplay.hidden };
var revit2018 = new Feature("Revit2018", "Revit2018的功能描述", true);
//var revit2019 = new Feature("Revit2019", "Revit2019的功能描述") { IsEnabled = false };
var revit2020 = new Feature("Revit2020", "Revit2020的功能描述", true);
//var pluginsFolder = @"%CommonAppDataFolder%\Autodesk\ApplicationPlugins\Sai.RvKits.bundle";
var pluginsFolder =
$@"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}\Autodesk\ApplicationPlugins\{Settings.AddInAppName}.bundle";
//var project = new ManagedProject("建模工具集",
// new Dir(@"%ProgramFiles%\Sai\Sai.RvKits",
// new File("Program.cs"), new Files(@"..\Sai.RvKit\bin\Debug\*.*")));
var project = new ManagedProject(
"建模工具集",
new WixEntity[]
{
//new Dir(@"%ProgramFiles%\Sai.RvKit"),
new Dir(baseFeature, pluginsFolder, new File($@"..\bin\{Settings.AddInAppName}.bundle\PackageContents.xml")),
new Dir(
new Id("R18"),
$@"{pluginsFolder}\Contents\2018",
new WixEntity[]
{
new Files(revit2018, @"..\bin\Debug\2018\*.*") /*, new File(revit2018, @"..\bin\Debug\2018\Sai.RvKits.addin")*/
}
),
//new Dir($"{pluginsFolder}\\Contents\\2019", new WixEntity[] { new Files(revit2019, @"..\bin\Debug\2019\*.*"), new File(revit2019, @"..\bin\Sai.RvKits.addin") }),
new Dir(
new Id("R20"),
$@"{pluginsFolder}\Contents\2020",
new WixEntity[]
{
new Files(revit2020, @"..\bin\Debug\2020\*.*") /*, new File(revit2020, @"..\bin\Debug\2020\Sai.RvKits.addin")*/
}
)
}
)
{
UI = WUI.WixUI_Minimal,
//GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b"),
GUID = new Guid("0EB16058-1682-4620-BD5A-BD777BFD4934"),
Language = "zh-cn",
Version = new Version(1, 0, 0, 0),
LocalizationFile = "WixUI_zh-CN.wxl",
//Feature = baseFeature,
DefaultFeature = revit2018,
// all stock UI dialogs
//ManagedUI = ManagedUI.DefaultWpf,
//MSI包名称
//project.OutFileName = "软件名称" + $"{DateTime.Now.Year}{DateTime.Now.Month:00}{DateTime.Now.Day:00}{DateTime.Now.Hour:00}{DateTime.Now.Minute:00}";
//custom set of UI WPF dialogs
ManagedUI = new ManagedUI(),
ValidateBackgroundImage = false, //关闭背景图片大小验证
BackgroundImage = @"Images\dlgbmp.png", //建议宽度156,高度312
BannerImage = @"Images\bannerbmp.png",
//安装新版本时自动卸载旧版本
UpgradeCode = new Guid("511EED44-E344-4821-BF25-B42175CE41AC"),
MajorUpgrade = new MajorUpgrade
{
AllowSameVersionUpgrades = true,
DowngradeErrorMessage = "当前安装的版本低于已安装的版,无法再次安装。",
AllowDowngrades = false,
Schedule = UpgradeSchedule.afterInstallValidate
}
};
project.OutFileName = $"建模工具集{project.Version}";
project.Package.AttributesDefinition = "Platform=x64";
project.ManagedUI.Icon = @"Images\Revit2021x.ico"; //标题栏图标
//设置控制面板制造商名称
project.ControlPanelInfo.Manufacturer = "Sai";
//设置控制面板图标
project.ControlPanelInfo.ProductIcon = @"Images\Revit2021x.ico";
//project.SourceBaseDir = "";
//project.OutDir = "