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:chauskne...@beracom.de] 
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:chauskne...@beracom.de]
Gesendet: Montag, 27. August 2012 11:04
An: wix-users@lists.sourceforge.net
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: chauskne...@beracom.de<mailto:chauskne...@beracom.de>
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
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
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to