0

I have a scenario in which i check for the user rights (whether a standard user or admin):

i am using something like:

<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" 
Default="yes" Text="!(loc.WixUINext)">

<Condition Message="Message text">Privileged</Condition>
<Publish Property="ALLUSERS" Value="1">INSTALLPREFA = "Every"</Publish>
<Publish Event="NewDialog" Value="MyInstallDirDlg">1</Publish>  

However it generates as error :

C:\myproject\MyInstallPrefa.wxs(25) : error CNDL0005 : The Publish element c ontains an     
unexpected child element 'Condition'.

Can't i check for admin rights inside a in a custom dialog , kindly help!!!.

Thanks

eddie
  • 252
  • 1
  • 5
  • 15

1 Answers1

0

As the error message states: Condition element cannot be used inside Publish element.
The condition is written as the inner text of Publish element.

Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
  • So you meant i need to write Priileged,something lke this. – eddie Jun 24 '12 at 16:18
  • @eddie Yes, I do. Look at how `Publish` elements look in the excerpt you posted. – Alexey Ivanov Jun 24 '12 at 19:16
  • :Publish element http://wix.sourceforge.net/manual-wix2/wix_xsd_publish.htm does not have a text property – eddie Jun 25 '12 at 05:28
  • :can u post the statement here. – eddie Jun 25 '12 at 05:39
  • I did not say about text attribute, I talked about element text; element text is what is between the opening tag and the closing tag. From the link you posted: _**Inner Text (xs:string)**: The element value is the optional Condition expression._ – Alexey Ivanov Jun 25 '12 at 09:51
  • And I said in my reply to your comment, that I mean something like that: `Privileged`. – Alexey Ivanov Jun 25 '12 at 09:52
  • :I used exactly what you wrote Privileged however compiling it gave me an error as C:\myproject\MyInstallPrefa.wxs(23) : error CNDL0044 : The Publish element's Event or Property attribute was not found; one of these is required.How do i get rid of this now? – eddie Jun 25 '12 at 12:20
  • Because `Publish` element does not have `Message` attribute, and I didn't say it was the correct statement, I only pointed out where the condition must be written. You have to create a dialog, or use an existing one, to show the error message. Read [WiX tutorial](http://wix.tramontana.co.hu/tutorial) about making UI. – Alexey Ivanov Jun 25 '12 at 13:15
  • I have the UI created and i am writing the statement under – eddie Jun 25 '12 at 13:38
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13011/discussion-between-alexey-ivanov-and-eddie) – Alexey Ivanov Jun 25 '12 at 17:43