Hi,

I am new to WIX, and I need to add following in machine.config.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="AspxContentProvider" 
publicKeyToken="b31f3856ad36435e" culture="neutral"/>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.25" newVersion="2.0.0.25"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DynamicXmlContentProvider" 
publicKeyToken="b31f3856ad36435e" culture="neutral"/>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.25" newVersion="2.0.0.25"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

However, when I use XmlConfig to add them into machine.config, I got below 
result.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly xmlns="">
        <assemblyIdentity name="AspxContentProvider" 
publicKeyToken="b31f3856ad36435e" culture="neutral"/>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.25" newVersion="2.0.0.25"/>
        <assemblyIdentity name="DynamicXmlContentProvider" 
publicKeyToken="b31f3856ad36435e" culture="neutral"/>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.25" newVersion="2.0.0.25"/>
      </dependentAssembly>
      <dependentAssembly xmlns=""/>
    </assemblyBinding>
  </runtime>
</configuration>

There are two issues here,

1.       The blank xmlns property for dependentAssembly is added by default. My 
question is how to remove it?

a.       I tried to delete the xmlns property by XmlConfig, but it didn't work.
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_Xmlns_b"
                             File="[MACHINECONFIG]"
                             Action="delete"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly"
                             Name="xmlns"
                             
VerifyPath="/configuration/runtime/assemblyBinding/dependentassembly[...@xmlns[\]]"
                             Sequence="11"
                             />

2.       The DynamicXmlContentProvider should be added in the second 
dependentAssembly element, however, it was added into the first one. I tried 
two methods and didn't get it work. Here below are my trying:

a.       Using the Id of parent element(Machine_Config_Runtime_Binding_AspxCP) 
as the value of ElementPath of assemblyIdentity element, but the installer 
complains that "Failed to find node: Machine_Config_Runtime_Binding_AspxCP in 
XML file..."

b.      Specifying 
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly[\[]last()[\]]",
 the installer says that "Failed to find node 
/configuration/runtime/assemblyBinding/dependentAssembly[last()]..."

I googled these two problem on the net, and found someone asked the similar 
questions but no answers for them.

Any suggestion for these two question?

BTW, I use wix 3.5.1823.0 build.

Below is my code for your reference:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";>
       <Product Id="9dd34ea9-680e-4530-960f-5a47580ded1a" 
Name="SetupProjectXML" Language="1033" Version="1.0.0.0" 
Manufacturer="SetupProjectXML" 
UpgradeCode="62ef531d-53e9-4eda-b6ce-5026e72b66fb">
              <Package InstallerVersion="200" Compressed="yes" />

              <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Property Id="MACHINECONFIG" Value="d:\machine.config" />
              <Directory Id="TARGETDIR" Name="SourceDir">
                     <Directory Id="ProgramFilesFolder">
                           <Directory Id="INSTALLLOCATION" 
Name="SetupProjectXML">
                                  <!-- TODO: Remove the comments around this 
Component element and the ComponentRef below in order to add resources to this 
installer. -->
                                  <Component Id="ProductComponent" 
Guid="4cca1ad5-ff2c-411a-8363-fe76d65f35d9">
                                          <!--TODO: Insert files, registry 
keys, and other resources here.-->
             <File Id="book" Name="books1.xml" Source="d:\books.xml" DiskId="1" 
 />
             <!-- Try to create runtime node first, in case it doesn't exist -->
             <util:XmlConfig Id="Machine_Config_Runtime"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             ElementPath="/configuration"
                             Node="element"
                             Name="runtime"
                             VerifyPath="runtime"
                             Sequence="1"
                             />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             ElementPath="/configuration/runtime"
                             Node="element"
                             Name="assemblyBinding"
                             
VerifyPath="assemblybinding[...@xmlns='urn:schemas-microsoft-com:asm.v1'[\]]"
                             Sequence="2"
                             />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_xmlns"
                              File="[MACHINECONFIG]"
                              ElementPath="Machine_Config_Runtime_Binding"
                              Name="xmlns"
                              Value="urn:schemas-microsoft-com:asm.v1"
                              Sequence="4"
                              />
             <util:XmlConfig Id ="Machine_Config_Runtime_Binding_AspxCP"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding"
                             Name="dependentAssembly"
                             Node="element"
                             Sequence="10">
             </util:XmlConfig>
             <!--<util:XmlConfig 
Id="Machine_Config_Runtime_Binding_AspxCP_Xmlns_b"
                             File="[MACHINECONFIG]"
                             Action="delete"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly"
                             Name="xmlns"
                             
VerifyPath="/configuration/runtime/assemblyBinding/dependentassembly[...@xmlns[\]]"
                             Sequence="11"
                             />-->
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_AI"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly"
                             Name="assemblyIdentity"
                             Node="element"
                             Sequence="12"
                             />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_AI_Name"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_AspxCP_AI"
                             Name="name"
                             Value="AspxContentProvider"
                             Sequence="13"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_AI_Token"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_AspxCP_AI"
                             Name="publicKeyToken"
                             Value="b31f3856ad36435e"
                             Sequence="14"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_AI_CT"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_AspxCP_AI"
                             Name="culture"
                             Value="neutral"
                             Sequence="15"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_BR"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
ElementPath="/configuration/runtime/assemblyBinding/dependentassembly[\[]assemblyidentity[...@name='AspxContentProvider'[\]][\]]"
                             Name="bindingRedirect"
                             Node="element"
                             Sequence="16"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_BR_OV"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_AspxCP_BR"
                             Name="oldVersion"
                             Value="1.0.0.0-2.0.0.25"
                             Sequence="17"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_AspxCP_BR_NV"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_AspxCP_BR"
                             Name="newVersion"
                             Value="2.0.0.25"
                             Sequence="18"
                                         />

             <util:XmlConfig Id ="Machine_Config_Runtime_Binding_DXCP"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding"
                             Name="dependentAssembly"
                             Node="element"
                             Sequence="20">
             </util:XmlConfig>
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_AI"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly"
                             Name="assemblyIdentity"
                             Node="element"
                             Sequence="22"
                             />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_AI_Name"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_DXCP_AI"
                             Name="name"
                             Value="DynamicXmlContentProvider"
                             Sequence="23"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_AI_Token"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_DXCP_AI"
                             Name="publicKeyToken"
                             Value="b31f3856ad36435e"
                             Sequence="24"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_AI_CT"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_DXCP_AI"
                             Name="culture"
                             Value="neutral"
                             Sequence="25"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_BR"
                             File="[MACHINECONFIG]"
                             Action="create"
                             On="install"
                             
ElementPath="/configuration/runtime/assemblyBinding/dependentassembly[\[]assemblyidentity[...@name='DynamicXmlContentProvider'[\]][\]]"
                             Name="bindingRedirect"
                             Node="element"
                             Sequence="26"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_BR_OV"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_DXCP_BR"
                             Name="oldVersion"
                             Value="1.0.0.0-2.0.0.25"
                             Sequence="27"
                                         />
             <util:XmlConfig Id="Machine_Config_Runtime_Binding_DXCP_BR_NV"
                             File="[MACHINECONFIG]"
                             
ElementPath="Machine_Config_Runtime_Binding_DXCP_BR"
                             Name="newVersion"
                             Value="2.0.0.25"
                             Sequence="28"
                                         />
                                  </Component>
                           </Directory>
                     </Directory>
              </Directory>

              <Feature Id="ProductFeature" Title="SetupProjectXML" Level="1">
                     <!-- TODO: Remove the comments around this ComponentRef 
element and the Component above in order to add resources to this installer. -->
                     <ComponentRef Id="ProductComponent" />

                     <!-- Note: The following ComponentGroupRef is required to 
pull in generated authoring from project references. -->
                     <ComponentGroupRef Id="Product.Generated" />
              </Feature>
       </Product>
</Wix>

Thanks,
-Roy
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to