You need to be careful here because it may not always work. You have 
impersonate="no" in your custom action so you're running with the local system 
account. If you get to a situation where somebody is installing your setup from 
a network share it's unlikely to work because the system account typically has 
no network access rights, and SourceDir is your MSI file's network location. 


Phil Wilson 


-----Original Message-----
From: daniel.knoep...@noser.com [mailto:daniel.knoep...@noser.com] 
Sent: Wednesday, July 14, 2010 2:24 AM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] Accessing Source directory in Deferred Custom Action 
(ApDataFolder etc. is working, just not SourceDir)

Hi and halleluja

I finally managed to access the SourceDir Property in the CustomAction data. 
The reason i could not access the SourceDir property earlier was simply that I 
scheduled the customAction to assign the properties to the CustomActiondata to 
early (It seems UI-sequence and execute sequence are different)

Here is what works: 

  <InstallExecuteSequence>
      <Custom Action="TestCA.SetProperty" After="CreateFolders"/>
      <Custom Action="CreateFolders" 
After="CopyChangingFilesAction.SetProperty"/>
   </InstallExecuteSequence>
 <CustomAction Id="TestCA.SetProperty" Return="check"
      Property="TestCA" 
Value="SourceDir=[SourceDir];INSTALLDIR=[INSTALLDIR];CommonAppDataFolder=[CommonAppDataFolder]">
    </CustomAction>
    <CustomAction Id="TestCA" BinaryKey="CustomActionDll" DllEntry="TestMethod" 
Impersonate="no" Execute="deferred" Return="check">
    </CustomAction>


Even though i like some aspectcs of msi (like the declarative approach), it 
seems to me that it is far more complicated than it could have been. Wix is a 
good start but - naturally - it cannot fully overcome the msi shortcomings. Or 
maybe I should have become something else in life

________________________________________
Von: daniel.knoep...@noser.com [daniel.knoep...@noser.com]
Gesendet: Mittwoch, 14. Juli 2010 10:11
An: wix-users@lists.sourceforge.net
Betreff: Re: [WiX-users] Accessing Source directory in Deferred Custom  Action 
(ApDataFolder etc. is working, just not SourceDir)

Hi

Since I haven't managed to assign the [SourceDir] value to a customAction Data 
Property, i tried to assign the data assign the value to a property and then 
assign that property to the a customAction. However, no success, the assigned 
property is empty. I am sure it is a simple syntax thing but i cant figure out 
the solution :-(

Here is what i did:
 <Property Id="TestProp" Value="[SourceDir]" />
  <SetProperty Id="TestProp" After="CostFinalize" Sequence="execute" 
Value="[SourceDir]" />

<InstallExecuteSequence>
<Custom Action="TestCA.SetProperty" After="InstallInitialize"/>
<Custom Action="TestCA" After="TestCA.SetProperty"/>
</InstallExecuteSequence>

<CustomAction Id="TestCA.SetProperty" Return="check"
Property="TestCA"
Value="TestingCAD=[TestProp];INSTALLDIR=[INSTALLDIR];AppDataFolder=[AppDataF
older]">
</CustomAction>
<CustomAction Id="TestCA" BinaryKey="CustomActionDll" DllEntry="TestMethod"
Impersonate="no" Execute="deferred" Return="check">
</CustomAction>

Still no success. :-(

I have found a workaround to set a property but thats something i want to avoid 
at any cost:

1. Define property "DUMMYPROPERTY"
2. Set property in C# custom action:      session["DUMMYPROPERTY"] = "i get 
assigned, jabadabadu";
3. Assign property to custom action data (as above)

So I am 100% sure that the syntax i use for the SourceDir property is wrong. It 
must be something simple.
I am grateful for any help.

Thanks


________________________________________
Von: Blair [os...@live.com]
Gesendet: Dienstag, 13. Juli 2010 18:34
An: 'General discussion for Windows Installer XML toolset.'
Betreff: Re: [WiX-users] Accessing Source directory in Deferred Custom  Action 
(ApDataFolder etc. is working, just not SourceDir)

In a verbose installation log, what is the resulting value of the TestCA
property?

-----Original Message-----
From: daniel.knoep...@noser.com [mailto:daniel.knoep...@noser.com]
Sent: Tuesday, July 13, 2010 8:24 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Accessing Source directory in Deferred Custom Action
(ApDataFolder etc. is working, just not SourceDir)

Hi

I would like to access the "SourceDir" property in a deferred custom action.
While i can access other directories via the CustomAction property (see
example below). The SourceDir ActionData remains empty. I must be doing
something wrong. I sure it's something silly, that only a wix newby can
stumble over.

Any help appreciated.
Thanks

My sample code:


<InstallExecuteSequence>

<Custom Action="TestCA.SetProperty" After="InstallInitialize"/>

<Custom Action="TestCA" After="TestCA.SetProperty"/>

</InstallExecuteSequence>



<CustomAction Id="TestCA.SetProperty" Return="check"

Property="TestCA"
Value="SourceDir=[SourceDir];INSTALLDIR=[INSTALLDIR];AppDataFolder=[AppDataF
older]">

</CustomAction>

<CustomAction Id="TestCA" BinaryKey="CustomActionDll" DllEntry="TestMethod"
Impersonate="no" Execute="deferred" Return="check">

</CustomAction>





In the C# code:



[CustomAction]

public static ActionResult TestMethod(Session session)

{

session.Log("CustomAction TestMethod called!");

.



try{

//   empty

string showMe = session.CustomActionData["SourceDir"];



// working, path

string showMe = session.CustomActionData["AppDataFolder"];
----------------------------------------------------------------------------
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


*** Confidentiality Notice: This e-mail, including any associated or attached 
files, is intended solely for the individual or entity to which it is 
addressed. This e-mail is confidential and may well also be legally privileged. 
If you have received it in error, you are on notice of its status. Please 
notify the sender immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any other person. This email comes from a division of the Invensys 
Group, owned by Invensys plc, which is a company registered in England and 
Wales with its registered office at Portland House, Bressenden Place, London, 
SW1E 5BF (Registered number 166023). For a list of European legal entities 
within the Invensys Group, please go to 
http://www.invensys.com/legal/default.asp?top_nav_id=77&nav_id=80&prev_id=77. 
You may contact Invensys plc on +44 (0)20 7821 3848 or e-mail 
inet.hqhelpd...@invensys.com. This e-mail and any attachments thereto may be 
subject to the terms of any agreements between Invensys (and/or its 
subsidiaries and affiliates) and the recipient (and/or its subsidiaries and 
affiliates).



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to