Ok, finally I just implemented a custom action, that performs the string
manipulation and sets a new property to the session. This property value I can
grab easily from within my product.wxs:
<Binary Id="MyCustomAction.dll" SourceFile="$(var.global.MyCAPath)"/>
<CustomAction Id="AdjustPath" BinaryKey="MyCustomAction.dll"
DllEntry="AdjustPath" Execute="immediate"/>
<!-- Execute Sequenz-->
<InstallExecuteSequence>
<Custom Action="AdjustPath" Before="CostFinalize"/>
</InstallExecuteSequence>
After that I can refer to the propery named ``FOOBASEPATH`` where the "trimmed"
path resides.
And here is the C# Code for the Custom Action:
namespace MyCustomActions
{
public class CustomActions
{
[CustomAction]
public static ActionResult AdjustPath(Session session)
{
session.Log("Begin AdjustPath");
session["FOOBASEPATH"] =
Path.GetDirectoryName(session["BURNSOURCEDIR"]) + @"\";
session.Log("End AdjustPath");
return ActionResult.Success;
}
}
}
As CAs are only callable from within Msi-Packages I must provide a temporary
Property containing the value of the Built-in burn property ``
WixBundleOriginalSource``. I named it ``BURNSOURCEDIR``. So I can set this
Property as a MsiProperty in my (burn) bundle definition:
<MsiPackage SourceFile="$(var.ClientMSIPath)">
<MsiProperty Name="BURNSOURCEDIR" Value="[WixBundleOriginalSource]"/>
</MsiPackage>
So the calling sequence is like this:
1.) "call" the Msi-Package and provide a Property named ``BURNSOURCEDIR`` with
the value of ``WixBundleOriginalSource``
2.) In the Msi-Package execute the custom action
3.) The CA sets the new Property ``FOOBASEPATH``
4.) Use ``FOOBASEPATH`` everywhere in the Msi-Package where one need it
5.) be happy :-D
Puh... much work for some little thing. But gained more knowledge about WiX,
burn and Windows Installer technologies. And in the end it works :-)
Best regards,
-----Ursprüngliche Nachricht-----
Von: Christian Hausknecht [mailto:[email protected]]
Gesendet: Mittwoch, 29. August 2012 11:58
An: General discussion for Windows Installer XML toolset.
Betreff: Re: [WiX-users] How to get the SourceDir in a MSI package that is
bundled within burn?
Ok, I try to explain the background:
The installer will be located in a remote folder in which most executables of
the client are located. The Clients are practically not really installed on the
local machine, only Shortcuts with the path to the executables on the remote
folder are generated (besides some other stuff).
Therefore I need the path, from which the installer was called. As I wrote at
the beginning, burn only offers a *complete path* including the name of the
installer (e.g. ``Z:\Foo\Bar\setup.exe``). I need the path without the
installer name.
That's the problem I have to solve :-)
-----Ursprüngliche Nachricht-----
Von: Neil Sleightholm [mailto:[email protected]]
Gesendet: Mittwoch, 29. August 2012 11:41
An: General discussion for Windows Installer XML toolset.
Betreff: Re: [WiX-users] How to get the SourceDir in a MSI package that is
bundled within burn?
Just stepping back at bit but why do you need the source of the burn install
passed into your MSI?
Neil
-----Original Message-----
From: Christian Hausknecht [mailto:[email protected]]
Sent: 29 August 2012 10:39
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How to get the SourceDir in a MSI package that is
bundled within burn?
Ok, my idea was good, but there is a problem with it. Burn does not support
searching *during* the installation process. So even if I have the correct
sequence in my chain, the RegistrySearch is always done at the beginning before
any packages are executed :-( Therefore my little helper program has not been
called yet when the search happens and so the key is not found.
I found the answer here:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/RegistrySearch-value-created-by-first-msi-as-input-to-second-msi-in-chain-td7518069.html
I did not recognize that, as I do not delete the key after uninstall. So my
installer always found one as it was written in the previous installation
process...
So back to brainstorming... I think only a custom action can help me now? (That
I can place in my MsiPackage and call it before any other actions?)
Damn, I wished I could get around that... imho creating your own CA looks quite
difficult...
Bet regards,
-----Ursprüngliche Nachricht-----
Von: Christian Hausknecht [mailto:[email protected]]
Gesendet: Dienstag, 28. August 2012 10:33
An: General discussion for Windows Installer XML toolset.
Betreff: Re: [WiX-users] How to get the SourceDir in a MSI package that is
bundled within burn?
Hm... no answer yet? Are my questions not understandable or too strange? ;-)
Ok, as perhaps some users might be interested in a solution, I present the way
I have chosen for now:
Basic Idea is to simply write a small C# Program, that gets the Path from a wix
burn bundle via CLI, "shortens" it by removing the ``setup.exe``-part and write
the result (the plain source path) into a defined registry key. Other
components of an installer bundle can retrieve this key and use the information
for further setup process.
The Mini-Program look like this:
namespace RegisterPath
{
class Program
{
static void Main(string[] args)
{
Registry.SetValue(string.Format(@"{0}\{1}",
RegisterPath.Properties.Resources.root, RegisterPath.Properties.Resources.key),
RegisterPath.Properties.Resources.valuename,
Path.GetDirectoryName(args[0]));
}
}
}
As you can see I use resource-strings for the definition of the registry key.
The fragment within the burn bundle to call the programm:
<Fragment>
<PackageGroup Id="RegisterPath">
<ExePackage Name="RegisterPath.exe" Id="RegisterPath_PK"
SourceFile="$(var.RegisterPathPath)"
InstallCommand='"[WixBundleOriginalSource]"'
Cache="no" Compressed="yes" PerMachine="yes" Vital="yes"/>
</PackageGroup>
</Fragment>
As you can see I use the ``WixBundleOriginalSource``-variable provided from
burn (Which is the "heart of the problem" ;-) ).
Further down in my bundle package I refer to this in order to provide the path
to a Msi-Package:
<Fragment>
<util:RegistrySearch Id="BasePathSearch"
Variable="BASEPATHPROP"
Root="HKCU"
Key="Software\$(var.Manufacturer)"
Result="value"
Value="BasePath" />
<PackageGroup Id="ClientMsi">
<MsiPackage SourceFile="$(var.ClientMSIPath)">
<MsiProperty Name="MYBASEPATH" Value="[BASEPATHPROP]\"/>
</MsiPackage>
</PackageGroup>
</Fragment>
One must take care that the Properties of the C#-Program and the attributes of
the RegistrySearch within the wix bundle are equal. Normally that does not
change too often, so I can live with that workaround for the moment.
Of course I would appreciate a more elegant solution; the best would be a
predefined variable by burn itself ;-)
Best regards,
-----Ursprüngliche Nachricht-----
Von: Christian Hausknecht [mailto:[email protected]]
Gesendet: Montag, 27. August 2012 13:00
An: General discussion for Windows Installer XML toolset.
Betreff: Re: [WiX-users] How to get the SourceDir in a MSI package that is
bundled within burn?
Ok, I kept thinking about the problem and I have an idea, that probably could
lead to the right direction.
I can define a msi-property within the bundle definition to that one must
assign the current path and that can be used within the MSI package definition
as reference. I tried the following approach:
<!-- Define MsiProperty within the burn bundle file --> <MsiPackage
SourceFile="$(var.ClientMSIPath)">
<MsiProperty Name="MYSOURCEDIR" Value="[WixBundleOriginalSource]\"/>
</MsiPackage>
<!-- Reference the property within the MSI definition --> <Shortcut
Id="Foo_ShortCut"
Name="Foo"
Description="Foo"
Target="[MYSOURCEDIR]Foo.exe"
WorkingDirectory="ProgramFilesFolder"/>
That would work fine besides the wix variable `` WixBundleOriginalSource``
holds not only the path of the starting dir but the complete path *including*
the exe-filename :-( Is there any way to "trim" the value or maybe another
burn-variable, that holds only the path?
-----Ursprüngliche Nachricht-----
Von: Christian Hausknecht [mailto:[email protected]]
Gesendet: Montag, 27. August 2012 11:04
An: [email protected]
Betreff: [WiX-users] How to get the SourceDir in a MSI package that is bundled
within burn?
Hello folks,
I have basically the same question as the guy here:
http://stackoverflow.com/questions/10573135/wix-installer-how-can-i-get-setup-exes-current-directory
I have created a MSI where some Shortcuts for the Menu and the Desktop are
created. They are created for applications, which are already installed and
therefore are not part of my installation routine. The installer itself is
located in the same directory. If I just test the MSI, then
``Target="[SourceDir]Foo.exe"`` just works as expected. But when I embedd this
MSI into a bundle built with burn, then [SourceDir] does not refer to the
Directory, where the Installer is located. Instead it refers to
"%TEMP%\{ProductID}\{Version}\Foo.exe". But I do not need this path but the one
I get if I install the MSI directly.
As the Path is variable, I *must* be able to refer to the actual "starting"
directory of the installer.exe. Can anyone provide a solution for that?
Greetings,
Mit freundlichen Grüßen
Christian Hausknecht
Entwicklung
BeraCom
Beratung und Software-Entwicklung GmbH & Co. KG Weidestr. 134, 22083 Hamburg
T: +49 (0)40 547 241 - DW
F: +49 (0)40 547 241 - 60
M: [email protected]<mailto:[email protected]>
http://www.beracom.de
=============================================
Kommanditgesellschaft: Sitz Hamburg, RG Hamburg, HRA 90932 Persönlich haftende
Gesellschafterin: BeraCom Beratung und Software-Entwicklung GmbH Sitz Hamburg,
RG Hamburg, HRB 64844
Geschäftsführer: Arno Schaefer, Britta Kahlfuss Diese E-Mail ist vertraulich
und exklusiv für den/die Adressaten bestimmt. Weiterleitung oder Kopieren, auch
auszugsweise, darf nur mit ausdrücklicher schriftlicher Einwilligung des
Absenders erfolgen. In jedem Fall ist sicherzustellen, dass keinerlei
inhaltliche Veränderungen erfolgen. Der Absender ist von der Richtigkeit dieser
Mail zum Zeitpunkt ihrer Erstellung überzeugt. Er und/oder sein Unternehmen
übernimmt jedoch keine Haftung für ihre Richtigkeit.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will include
endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will include
endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will include
endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will include
endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will include
endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will include
endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users