I was trying to modify an .ini file in Wix
If it does not exists, the msi does not complete....
how do I check for this
I really want to modify it
Yes I looked at other stackoverflow questions/answers and on google
I was trying this...
<Component Id="TestIni" Guid="*">
<CreateFolder />
<IniFile Id="Ini1"
Action="createLine"
Directory="INSTALLLOCATION"
Section="Test"
Name="Minimal.ini"
Key="TestKey"
Value="TestValue" />
<IniFile Id="Ini2"
Action="createLine"
Directory="WindowsFolder"
Section="Test"
Name="Minimal.ini"
Key="TestKey"
Value="WindowsFolder TestValue" />
</Component>
Use Action="addLine" or Action="addTag" if you want to modify an existing value.
You could use the FileSearch element to set a property and then use this property in a condition.
Related
Basically i want to add <Condition>0</Condition> element under the <Component>..</Component> element when i harvest a directory using heat.exe
I should look like below
<Component Id='JapaneseFlag' Guid='{4CB0C1EE-8370-4880-B172-CF1E9F7308F7}'>
<File Id='JaFlag' Source='.\ja.png'></File>
<Condition>INSTALLEDSWVERSION = "XYZ"</Condition>
</Component>
and i also want the conditional feature for the above component under the feature element, like
<Feature Id='JA_Flag' Title='Japanese Flag' Level='1'>
<Condition Level='0'>NOT (INSTALLEDSWVERSION = "XYZ")</Condition>
<ComponentRef Id='JapaneseFlag'/>
</Feature>
Is this possible using heat?
if not, So Is there any way to do this dynamically?
Any clue would help me to google further.
Yes, you can use xslt to transform the generated wxs file.
Check this for example.
I was setting a property value inside a Dialog using Edit Control. But when i used the same property for writing inside an ini value it is not writing the updated value and writing only old value. My WIX source code is given below(writing only important codes as my wix code is too large)
<Property Id="testNumber" Value="1122" />
<CustomAction Id="SettestNumber" Property="ModifiedtestNumber" Value="[testNumber]" />
<ComponentGroup Id="INIFileGroup">
<Component Id="IniFile" Guid="{0ded271b-9268-49e7-8c13-60c7538acc25}" KeyPath="yes" Directory="DirCfg" >
<IniFile Id="IniPath" Action="addLine" Directory="Dirtest" Key="testkey" Name="test.ini" Section="test" Value="[ModifiedtestNumber]" />
</Component>
</ComponentGroup>
<InstallUISequence>
<Custom Action="SettestNumber" Sequence="1299"/>
</InstallUISequence>
<Dialog Id="testNumberUI" X="50" Y="50" Width="375" Height="270" Title="[ProductName]" CustomPalette="yes">
<Control Type="Edit" Id="test_Number" Width="50" Height="15" X="258" Y="53" Property="testNumber" Text="{50}" TabSkip="yes"/>
</Dialog>
I am giving the value 1212 in the Control edit box and installing but inside the test.ini file it is not getting updated and value is 1122. Could someone please provide a way for me to update the Modifedtestnumber to the ini file
Note:
When i put the Custom action inside < InstallExecuteSequence/> the value inside the ini file was null
Your property need to be public (all caps TESTNUMBER) and marked with Secure attribute so that it's listed in the SecureCustomPublicProperties property. Also be aware that properties are not persisted. You need to use something like the WiX remember property pattern for the value to be loaded from the INI file during subsequent transactions such as repairs and upgrades.
I had the following "Reg2015" component in RTM in which I forgot to assign KeyPath:
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="Reg2015" Guid="{xxx}" Win64="no" >
<RegistryKey Root="HKLM" Key="SOFTWARE\Mine" >
<RegistryValue Name="RefCount" Value="1" Type="integer" />
<RegistryValue Name="Name" Value="Mine" Type="string" Action="write" />
</RegistryKey>
</Component>
...
</DirectoryRef>
To prepare the patch, I changed "RefCount" to "2" and added to patch wxs.
Now PYRO.EXE complains like this:
error PYRO0243: Component 'Reg2015' has a changed keypath in the transform 'C:\Patch\Patch.Wixmst'. Patches cannot change the keypath of a component.
error PYRO0260: Product '{xxx}': Table 'CreateFolder' has a new row 'INSTALLLOCATION/Reg2015' added. This makes the patch not uninstallable.
I understand since there was no "KeyPath", its KeyPath defaulted to INSTALLLOCATION, but didn't know that component ID was considered as a directory.
(1) Can someone explain why?
(2) Is there any way to pass PYRO errors?
(3) For my next major release, if I add "KeyPath" to any of "RegistryValue" element, like
<RegistryValue Name="RefCount" Value="1" Type="integer" KeyPath="yes" />
should I be able to change "RefCount" to 2 in the future patch?
Thanks.
I think WiX selected Refcount as the keypath for the component - that's what the docs say. " If KeyPath is not set to 'yes' for the Component or for a child Registry value or File, WiX will look at the child elements under the Component in sequential order and try to automatically select one of them as a key path. Allowing WiX to automatically select a key path can be dangerous because adding or removing child elements under the Component can inadvertantly cause the key path to change, which can lead to installation problems. " You could verify that by looking in the MSI file with Orca to see what the Component table says about it.
So changing the keypath value probably resulted in that issue. It would be better to set another registry item (or create a new one) in the component to be the keypath.
Seems like I'm forever asking questions about Wix.
This should be the last, and it's just a polishing one.
I'm wanting my associated files to have an icon to go with them, but in my ProgId element, the advertise is not specified which I assume defaults to no.
Therefore in the wix documentation, it states:
For an advertised ProgId, the Id of an Icon element. For a non-advertised ProgId, this is the Id of a file containing an icon resource.
I'm not understanding how this works at all. Do I set up a folder that contains the icon and reference it with IconIndex? This is the part of the .wxs I'm working with.
<Component Id ="MyApp.exe" Guid="{GUID-HERE}">
<File Id="MyApp.exe" KeyPath="yes" Source="$(var.MyApp.TargetDir)MyApp.exe" />
<ProgId Id ="MyAppProgID" Description="MyApp data files" Icon ="Logo.ico" IconIndex="0">
<Extension Id ="myapp" ContentType="application/myapp">
<Verb Id ="open" Command="open" TargetFile="MyApp.exe" Argument=""%1""/>
</Extension>
</ProgId>
<Icon Id="Logo.ico" SourceFile="$(var.MyApp.TargetDir)\Icon\Logo.ico"/>
I'm struggling to find any examples or proper documentation on a lot of the ProgId functionality for wix.
Thanks in advance
You need to change the Icon element to File and remove IconIndex
<Component Id ="MyApp.exe" Guid="{GUID-HERE}">
<File Id="MyApp.exe" KeyPath="yes" Source="$(var.MyApp.TargetDir)MyApp.exe" />
<File Id="Logo.ico" Source="$(var.MyApp.TargetDir)\Icon\Logo.ico"/>
<ProgId Id ="MyAppProgID" Description="MyApp data files" Icon ="Logo.ico">
<Extension Id ="myapp" ContentType="application/myapp">
<Verb Id ="open" Command="open" TargetFile="MyApp.exe" Argument=""%1""/>
</Extension>
</ProgId>
I have XML file that include a next content:
<!--<appcache appCacheType="None" />-->
<appcache appCacheType="SingleClient" defaultExpiration="3600"/>
On installation patch i need to change this content in XML file to:
<appcache appCacheType="None" />
<!--<appcache appCacheType="SingleClient" defaultExpiration="3600"/>-->
What is a better way to do it?
Thanks.
I tried (in vain) to use the MSI Community Extensions for this purpose, but wasn't able to get them up and running.
I ended up using the util:XmlFile-tag from the Util-extension that works flawlessly.
Add the namespace of the Util-extension to your source-file in the Wix-element:
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
Then use it as sub-element of a related component. In your case you want to delete an attribute and change the value of another one. The following should do the trick, just adjust the XPath in the ElementPath-attribute to the one that matches your tag (in the example it updates the appcache-tag which has an attribute appCacheType with the value SingleClient) and the filekey of the XML-file:
<Component Id="myComponentToUpdateTheXmlFile" ... >
<!-- Removing the defaultExpiration-attribute first -->
<util:XmlFile Id="UpdateAppCacheTag" Action="deleteValue" ElementPath="//appcache[\[]#appCacheType='SingleClient'[\]]/#defaultExpiration" File="[#MyConfigFile.xml]" SelectionLanguage="XPath" Sequence="1" Name="defaultExpiration" />
<!-- Now updating the value -->
<util:XmlFile Id="UpdateAppCacheTag" Action="setValue" ElementPath="//appcache[\[]#appCacheType='SingleClient'[\]]/#appCacheType" File="[#MyConfigFile.xml]" SelectionLanguage="XPath" Sequence="2" Value="None" />
</Component>
Be sure to add the Util-extension also on the commandline when invoking candle and light:
<candle or light command line> ... <parameters> ... -ext <PathToWiXExtensions>\WixUtilExtension.dll
If you want to do this only during e.g. patching, then add the appropriate condition for this component.