c# - wix # script for creating a installer -


i have wpf application helps user selects directory path , when click create installer button want create installer user selected directory(inside directory there may me more 1 file).

i came know can use wix# script , call script when button clicked. don't know how write wix# script take input file (the file installer going create).

i familier basic wix , new wix #. please me solve problem.

you try wixsharp solution.

you can nuget reference option (visual studio), need write code works want it.

i'll make c# example:

static string srootdir = @"<path of source directory>"; static void buildmsi()         {                                               wixentity[] wedir = new wixentity[0];             wedir = builddirinfo(srootdir, wedir);             var project = new project("my product", wedir)             {                 guid = guid.newguid(),                 //ui = wui.wixui_installdir,                 version = new version(55, 0, 0, 0),                 upgradecode = guidupgradecode, // forwarded if upgrading existing product                 majorupgradestrategy = new majorupgradestrategy                 {                     upgradeversions = versionrange.olderthanthis,                     preventdowngradingversions = versionrange.newerthanthis,                     newerproductinstallederrormessage = "newer version installed"                 }             };              project.buildmsi(project);         }    static wixentity[] builddirinfo(string srootdir, wixentity[] wedir)         {             directoryinfo rootdirinfo = new directoryinfo(srootdir);             if (rootdirinfo.exists)             {                 directoryinfo[] dirinfo = rootdirinfo.getdirectories();                 list<string> lmaindirs = new list<string>();                 foreach (directoryinfo dirinfosub in dirinfo)                     lmaindirs.add(dirinfosub.fullname);                 int cnt = lmaindirs.count;                 wedir = new wixentity[cnt + 1];                 if (cnt == 0)                     wedir[0] = new dirfiles(rootdirinfo.fullname + @"\*.*");                 else                 {                     wedir[cnt] = new dirfiles(rootdirinfo.fullname + @"\*.*");                     (int = 0; < cnt; i++)                     {                         directoryinfo rootsubdirinfo = new directoryinfo(lmaindirs[i]);                         if (!rootsubdirinfo.exists)                             continue;                         wixentity[] wesubdir = new wixentity[0];                         wesubdir = builddirinfo(rootsubdirinfo.fullname, wesubdir);                         wedir[i] = new dir(rootsubdirinfo.name, wesubdir);                     }                 }             }             return wedir;         } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -