session properties and subfolders

Apr 29, 2015 at 10:56 AM
Hi folks,

Stepping out your "AdminInstall" project I would like to copy some files and set some shortcuts to a special folders.

I have defined several "Dir" objects in my project.

new Dir(@"[INSTALLDIR]",

new WixSharp.File(binaries, @"AppFiles\ConverterGUI.dll"), new WixSharp.File(binaries, @"AppFiles\ConverterLib.dll"), new WixSharp.File(binaries, @"AppFiles\ConverterInterlink.dll") new Dir(@"[DOCUPATH]", new WixSharp.File(docs, @"AppFiles\HandbuchGMC-Konverter.pdf")), new Dir(@"[DATABASEDIR]Formatkonverter", new WixSharp.File(database, @"AppFiles\ConfigurationDatabase.mdb")), new Dir(@"[MWSC]GMC Konverter",
new ExeFileShortcut(binaries, "Messwertverwaltung", "[INSTALLDIR]Messwertverwaltung.exe", " ")),

"MWSC", "DOCUPATH" and "DATABASEDIR" are properties I predefined in my Main method (project.Properties = new[]
new Property("DATABASEDIR", @"C:\Qmax\Server\QmDocDir"),
new Property("STARTDIR", @"C:\Qmax"),
new Property("LOGPATH", @"%ProgramData%\GMC Systems\Konverter\Log\"),
new Property("MWSC", "LEER"),
new Property("DOCUPATH", @"%ProgramData%\GMC Systems\Konverter\Doku\"),
new Property("WINOS", "LEER"),
and set in a custom action via session["property name"]="valid string"

TARGETDIR is assigned to "e:". Wix sharp produce a Property named TARGETDIR._MWSC_GMC_Konverter and set it to e:[MWSC]GMC Konverter\ and copy the data to this folder etc.

How can I access my session property? Please ask me what I misobeyed.

Moreover I have to add some resource files. Some of this files are in folders with several subfolders.

Here is what I tried:

new Dir(@"[CommonAppDataFolder]GMC Systems\Konverter\",
new Dir(NetSRCXP, "WIN_XP_VISTA_SERVER2003_SERVER2008_NET", new DirFiles(NetSRCXP, @"AppFiles\WIN_XP_VISTA_SERVER2003_SERVER2008_NET*.")), new Dir(NetSRC8, "WIN81NET", new DirFiles(NetSRC8, @"AppFiles\WIN8NET*.")), new Dir(NetSRC81, "WIN8NET", new DirFiles(NetSRC81, @"AppFiles\WIN81NET*.*"))) Using DirFiles failed? How can I take all files from all subfolders?

Many thanks in advance!
Apr 30, 2015 at 5:16 AM
How can I access my session property?

the same was as you assigned it:
string value = session["property name"];
DirFiles failed? How can I take all files from all subfolders?
You need to use "Files" class . Have a look at Release Folder sample.

A few notes.
It is better not to use square brackets in the explicit IDs (e.g. 'new Dir(@"[INSTALLDIR]"') as these brackets have special meaning for MSI/WiX. In fact you can skip , INSTALLDIR at all as it will be auto generated for you.
Also keep in mind that if you preserve wxs file with Compiler.PreserveTempFiles = true; you can troubleshoot your setup more effectively.
Apr 30, 2015 at 7:53 AM

I would like to access my session property in the main method. The problem is that session object doesn't exists in the main method.
May 1, 2015 at 1:31 AM
The 'main' method is the entry point of your setup build script. It is executed when you build your MSI and never else. When you execute your MSI the only your code that can be invoked is your custom action and it has session argument. So you need to do what ever you are trying to do in the custom action code.