I struggle with Windows Deployment Services (WDS) right now.
So, what I want to achieve:
Create local admin account with given password.
Configure partition.
Join corporate domain my.domain.eu.
Skip OOBE.
For now, only first point is done - local admin account is created after initial setup, but somehow, I'm not able to achieve rest of it.
During installation, it first asks me for a language, and later on - for domain user & password. After I pass it - for partition config.
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>password</Value>
<PlainText>false</PlainText>
</Password>
<DisplayName>localadmin</DisplayName>
<Group>Administrators</Group>
<Name>localadmin</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
</component>
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
</component>
</settings>
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Active>true</Active>
<Format>NTFS</Format>
<Label>Local Disk</Label>
<Letter>C</Letter>
<Order>1</Order>
<PartitionID>1</PartitionID>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
</DiskConfiguration>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Identification>
<Credentials>
<Domain>netbios_name</Domain>
<Password>password</Password>
<Username>domain_account</Username>
</Credentials>
<JoinDomain>my.domain.eu</JoinDomain>
<UnsecureJoin>true</UnsecureJoin>
<MachineObjectOU>OU=Deploy_TEST,OU=Computers</MachineObjectOU>
</Identification>
</component>
</settings>
<cpi:offlineImage cpi:source="/path/to/file.wim" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
Nevermind, I fixed that:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>us-US</UILanguage>
</SetupUILanguage>
<InputLocale>us-US</InputLocale>
<SystemLocale>us-US</SystemLocale>
<UILanguage>us-US</UILanguage>
<UserLocale>us-US</UserLocale>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<WindowsDeploymentServices>
<Login>
<Credentials>
<Domain>netbios</Domain>
<Username>domain_suer</Username>
<Password>password</Password>
</Credentials>
</Login>
</WindowsDeploymentServices>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>password</Value>
<PlainText>false</PlainText>
</Password>
<DisplayName>admin</DisplayName>
<Group>Administrators</Group>
<Name>admin</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
</component>
</settings>
<cpi:offlineImage cpi:source="wim://path/to/file" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
Related
I have the following XML content:
<fragment>
<directory Id="dirABC" Name="ABC">
<component Id="cmpA" Guid="*">
<file Id="filA" KeyPath="yes" Source="SourceRootDir\AAA.exe" />
</component>
<component Id="cmpB" Guid="*">
<file Id="filB" KeyPath="yes" Source="SourceRootDir\BBB.exe" />
</component>
<component Id="cmpC" Guid="*">
<file Id="filC" KeyPath="yes" Source="SourceRootDir\CCC.exe" />
</component>
</directory>
</fragment>
I am trying to find the file elements that have the Source attribute ending with 'BBB.exe' and replace its Id attribute with another value, e.g. with filNEW. In my example the Id attribute value 'filB' should be changed to 'filNEW'. So, my XSLT is defined the following way:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output omit-xml-declaration="no" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="/fragment/directory/component/file[substring(#Source, string-length(#Source) - string-length('BBB.exe') + 1) = 'BBB.exe']">
<xsl:attribute name="Id">filNEW</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
However, instead of updating only the Id attribute of the file element of the second component element, the result has the whole file element removed for the second component and has the component element's Id attribute value replaced with the new filNEW value. The current result.
<?xml version="1.0" encoding="UTF-8"?>
<fragment>
<directory Id="dirABC" Name="ABC">
<component Guid="*" Id="cmpA">
<file Id="filA" KeyPath="yes" Source="SourceRootDir\AAA.exe"/>
</component>
<component Guid="*" Id="filNEW"/>
<component Guid="*" Id="cmpC">
<file Id="filC" KeyPath="yes" Source="SourceRootDir\CCC.exe"/>
</component>
</directory>
</fragment>
Whereas, I am trying to get this result:
<?xml version="1.0" encoding="UTF-8"?>
<fragment>
<directory Id="dirABC" Name="ABC">
<component Guid="*" Id="cmpA">
<file Id="filA" KeyPath="yes" Source="SourceRootDir\AAA.exe"/>
</component>
<component Id="cmpB" Guid="*">
<file Id="filNEW" KeyPath="yes" Source="SourceRootDir\BBB.exe" />
</component>
<component Guid="*" Id="cmpC">
<file Id="filC" KeyPath="yes" Source="SourceRootDir\CCC.exe"/>
</component>
</directory>
</fragment>
What am I doing wrong in the XSLT?
You are matching on the file element and then generating an attribute. If you just want to replace the value of the #Id attribute, then change your match expression to match on that #Id by adding /#Id after the predicate on the file:
<xsl:template match="/fragment/directory/component/file[substring(#Source, string-length(#Source) - string-length('BBB.exe') + 1) = 'BBB.exe']/#Id">
<xsl:attribute name="Id">filNEW</xsl:attribute>
</xsl:template>
I have some troubles with my answer file. The file works exept the "Disk Configuration" part.
The Dialog popups every time even when i set the Value WillShowUI to "Never". I already tried so many examples from the internet, but none of them worked.
What's the Problem with my file? Is there any log file?
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<WillShowUI>OnError</WillShowUI>
<UILanguage>de-DE</UILanguage>
</SetupUILanguage>
<InputLocale>de-DE</InputLocale>
<SystemLocale>de-DE</SystemLocale>
<UILanguageFallback>de-DE</UILanguageFallback>
<UILanguage>de-DE</UILanguage>
<UserLocale>de-DE</UserLocale>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<WindowsDeploymentServices>
<Login>
<Credentials>
<Domain>domain.local</Domain>
<Password>MySecretPassword</Password>
<Username>Administrator</Username>
</Credentials>
<WillShowUI>OnError</WillShowUI>
</Login>
<ImageSelection>
<InstallImage>
<Filename>install.wim</Filename>
<ImageName>Windows 10 Education</ImageName>
<ImageGroup>Windows 10</ImageGroup>
</InstallImage>
<WillShowUI>OnError</WillShowUI>
</ImageSelection>
</WindowsDeploymentServices>
<EnableFirewall>false</EnableFirewall>
<EnableNetwork>false</EnableNetwork>
<DiskConfiguration>
<WillShowUI>Never</WillShowUI>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<CreatePartition wcm:action="add">
<Extend>false</Extend>
<Order>1</Order>
<Size>500</Size>
<Type>Primary</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Extend>false</Extend>
<Size>100</Size>
<Type>EFI</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Extend>false</Extend>
<Order>3</Order>
<Size>128</Size>
<Type>MSR</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Extend>true</Extend>
<Order>4</Order>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Format>NTFS</Format>
<Label>WinRE</Label>
<Order>1</Order>
<PartitionID>1</PartitionID>
<TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Format>FAT32</Format>
<Label>System</Label>
<Order>2</Order>
<PartitionID>2</PartitionID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Order>3</Order>
<PartitionID>3</PartitionID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Format>NTFS</Format>
<Label>Windows</Label>
<Letter>C</Letter>
<Order>4</Order>
<PartitionID>4</PartitionID>
<Active>true</Active>
</ModifyPartition>
</ModifyPartitions>
</Disk>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>4</PartitionID>
</InstallTo>
<WillShowUI>OnError</WillShowUI>
</OSImage>
</ImageInstall>
<UserData>
<ProductKey>
<WillShowUI>Never</WillShowUI>
<Key>YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY</Key>
</ProductKey>
<AcceptEula>true</AcceptEula>
<FullName>My Name</FullName>
<Organization>MyCompany</Organization>
</UserData>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:d:/win10edu/install.wim#Windows 10 Education" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
I've been trying to figure out how to get WSO2's ESB to make calls to two different APIs and combine their results into a single response, and running into nothing but trouble. At its most basic, I've got two backends I'm making requests to that respond something like this:
http://example.com/items:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<response xmlns="http://example.com/response">
<query name="items" xmlns="http://example.com/query">
<row>
<id>1</id>
<name>Item 1</name>
</row>
<row>
<id>2</id>
<name>Item 2</name>
</row>
</query>
</response>
</soapenv:Body>
</soapenv:Envelope>
http://example.com/parts:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<response xmlns="http://example.com/response">
<query name="parts" xmlns="http://example.com/query">
<row>
<id>1</id>
<part>Part 1.1</part>
</row>
<row>
<id>1</id>
<part>Part 1.2</part>
</row>
<row>
<id>1</id>
<part>Part 1.3</part>
</row>
<row>
<id>2</id>
<part>Part 2.1</part>
</row>
<row>
<id>2</id>
<part>Part 2.2</part>
</row>
</query>
</response>
</soapenv:Body>
</soapenv:Envelope>
I'd like to request both of those, then combine their results to look something like this:
<items>
<item>
<id>1</id>
<name>Item 1</name>
<parts>
<part>
<id>1</id>
<name>Part 1.1</name>
</part>
<part>
<id>1</id>
<name>Part 1.2</name>
</part>
<part>
<id>1</id>
<name>Part 1.3</name>
</part>
</parts>
</item>
<item>
<id>2</id>
<name>Item 2</name>
<parts>
<part>
<id>2</id>
<name>Part 2.1</name>
</part>
<part>
<id>2</id>
<name>Part 2.2</name>
</part>
</parts>
</item>
</items>
Basically, every response from both APIs has a list of rows, each of which contains an id element. The ids in the call to /items are unique within that response, and each row in the response from parts has an id that ties it to a row from /items.
I've got the following API definition in the ESB:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/item_list" name="ItemList" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/">
<inSequence>
<header name="Content-Type" scope="transport" value="text/xml; charset=utf-8"/>
<clone>
<target>
<sequence>
<send>
<endpoint>
<address format="soap11" uri="http://example.com/items"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<send>
<endpoint>
<address format="soap11" uri="http://example.com/parts"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<aggregate>
<correlateOn expression="//*[name()='response']/*[name()='query']/*[name()='row']/*[name()='id']" />
<completeCondition>
<messageCount max="2" min="2"/>
</completeCondition>
<onComplete expression="//*[name()='response']/*[name()='query']/*[name()='row']">
<send/>
</onComplete>
</aggregate>
</outSequence>
<faultSequence/>
</resource>
</api>
The inSequence here is heavily simplified, but it does send two valid queries and gets back the expected responses. The outSequence as it's written here never sends a response to the client or logs an error on the server. If I remove the correlateOn element from aggregate, I get back a single row, seemingly at random, from one of the two API calls. I think correlateOn is something I want to be using here, but I can't find any useful documentation on it from either WSO2 or Apache, so I'm sure I'm using it incorrectly. My XPath background is pretty weak, so I'm sure that expression could also use some work.
Am I at least on the right track here with the clone/aggregate pattern? How would I go about combining the results from these two queries into something similar to my example? If I can get something even sort of close, I should be able to do the rest with XSLT.
take a look at this demo:
Backend 1 with the items response:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="items"
transports="https http"
startOnLoad="true">
<target>
<inSequence>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<response xmlns="http://example.com/response">
<query xmlns="http://example.com/query" name="items">
<row>
<id>1</id>
<name>Item 1</name>
</row>
<row>
<id>2</id>
<name>Item 2</name>
</row>
</query>
</response>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="full"/>
<loopback/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
Backend 2 with the parts response:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="parts"
transports="https http"
startOnLoad="true">
<target>
<inSequence>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<response xmlns="http://example.com/response">
<query xmlns="http://example.com/query" name="parts">
<row>
<id>1</id>
<part>Part 1.1</part>
</row>
<row>
<id>1</id>
<part>Part 1.2</part>
</row>
<row>
<id>1</id>
<part>Part 1.3</part>
</row>
<row>
<id>2</id>
<part>Part 2.1</part>
</row>
<row>
<id>2</id>
<part>Part 2.2</part>
</row>
</query>
</response>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="full"/>
<loopback/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
My API calling backend 1 and backend 2 and transforming with xslt:
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
name="ItemList"
context="/item_list">
<resource methods="POST" uri-template="/">
<inSequence>
<header name="Action" scope="default" value="urn:mediate"/>
<call>
<endpoint>
<address uri="http://localhost:8283/services/items.itemsHttpSoap11Endpoint"
format="soap11"/>
</endpoint>
</call>
<enrich>
<source type="inline" clone="true">
<Payloads/>
</source>
<target type="property" property="Items"/>
</enrich>
<enrich>
<source clone="true" xpath="$body/*"/>
<target action="child" xpath="$ctx:Items"/>
</enrich>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body/>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<call>
<endpoint>
<address uri="http://localhost:8283/services/parts.partsHttpSoap11Endpoint"
format="soap11"/>
</endpoint>
</call>
<enrich>
<source clone="true" xpath="$body/*[name()='response']/*[name()='query']"/>
<target type="property" property="Parts"/>
</enrich>
<enrich>
<source type="property" clone="true" property="Parts"/>
<target action="child" xpath="$ctx:Items"/>
</enrich>
<enrich>
<source type="property" property="Items"/>
<target type="body"/>
</enrich>
<xslt key="transformTwoSourcesToOneResult"/>
<loopback/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
</api>
And my xslt transformation:
<?xml version="1.0" encoding="UTF-8"?>
<localEntry key="transformTwoSourcesToOneResult" xmlns="http://ws.apache.org/ns/synapse">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://example.com/query"
xmlns:ns1="http://example.com/response"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:exslt="http://exslt.org/common"
xmlns:saxon="http://saxon.sf.net/"
xmlns:syn="http://ws.apache.org/ns/synapse"
exclude-result-prefixes="ns0 ns1 xs">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:variable name="var1_instance_Payloads" select="."/>
<items>
<xsl:for-each select="$var1_instance_Payloads/syn:Payloads">
<xsl:variable name="var2_Payloads" select="."/>
<xsl:for-each select="$var2_Payloads/ns1:response/ns0:query/ns0:row">
<xsl:variable name="var2_row" select="."/>
<item>
<id>
<xsl:value-of select="number(string($var2_row/ns0:id))"/>
</id>
<name>
<xsl:value-of select="string($var2_row/ns0:name)"/>
</name>
<parts>
<xsl:for-each select="$var2_Payloads/ns0:query/ns0:row">
<xsl:variable name="var4_row" select="."/>
<xsl:if test="string((number(string($var2_row/ns0:id)) = number(string($var4_row/ns0:id)))) != 'false'">
<part>
<id>
<xsl:value-of select="number(string($var4_row/ns0:id))"/>
</id>
<name>
<xsl:value-of select="string($var4_row/ns0:part)"/>
</name>
</part>
</xsl:if>
</xsl:for-each>
</parts>
</item>
</xsl:for-each>
</xsl:for-each>
</items>
</xsl:template>
</xsl:stylesheet>
</localEntry>
The API response:
<items xmlns="http://ws.apache.org/ns/synapse" xmlns:syn="http://ws.apache.org/ns/synapse" xmlns:saxon="http://saxon.sf.net/" xmlns:exslt="http://exslt.org/common">
<item>
<id>1</id>
<name>Item 1</name>
<parts>
<part>
<id>1</id>
<name>Part 1.1</name>
</part>
<part>
<id>1</id>
<name>Part 1.2</name>
</part>
<part>
<id>1</id>
<name>Part 1.3</name>
</part>
</parts>
</item>
<item>
<id>2</id>
<name>Item 2</name>
<parts>
<part>
<id>2</id>
<name>Part 2.1</name>
</part>
<part>
<id>2</id>
<name>Part 2.2</name>
</part>
</parts>
</item>
</items>
What is the XPATH for attribute newVersion in the element
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
I have tried my best to do it by myself. But don't know how to get XPATH for elements with namespace. Its very confusing. Somebody please provide me a XPATH.
XPATH which I came up with is
/configuration/runtime/assemblyBinding/dependentAssembly[2]/bindingRedirect[#newVersion='2.2.5.0']/#newVersion
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<legacyUnhandledExceptionPolicy enabled="1" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect name="Test1" oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
The right xpath is
XPATH:
/configuration/runtime/ns:assemblyBinding/ns:dependentAssembly[ns:assemblyIdentity[#name='System.Reactive.Linq']]/ns:bindingRedirect/#newVersion
Where ns is the namespace urn:schemas-microsoft-com:asm.v1
I use a XmlPoke Task in the MSBuild tasks in the project file to modify the binding redirect.
Together with a XmlPoke Task the code goes like this:
<XmlPoke XmlInputPath="$(DestXmlFiles)"
Namespaces="<Namespace Prefix='ns' Uri='urn:schemas-microsoft-com:asm.v1' Name='DoNotKnowWhatThisIsFor-ButItIsRequired' />"
Query="/configuration/runtime/ns:assemblyBinding/ns:dependentAssembly[ns:assemblyIdentity[#name='System.Reactive.Linq']]/ns:bindingRedirect/#newVersion"
Value="$(BUILD_NUMBER)"/>
In XSLT 1.0 you must declare namespaces with a prefix in order to be able to use them in XPath.
For example (wrapped for legibility):
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:asm="urn:schemas-microsoft-com:asm.v1"
>
<xsl:template match="/">
<xsl:value-of select="
/configuration/
runtime/
asm:assemblyBinding/
asm:dependentAssembly[2]/
asm:bindingRedirect[#newVersion = '2.2.5.0']/#newVersion
" />
</xsl:template>
</xsl:stylesheet>
However, you don't have to specify the entire path, you could take shortcuts:
<xsl:value-of select="
//asm:assemblyIdentity[#name='System.Reactive.Linq']/
asm:bindingRedirect[#newVersion = '2.2.5.0']/#newVersion
" />
How to create a sub folder in installation folder(which in my case is named WWU)? I am creating an installation folder named WWU in Program Files, I want to create a sub folder named image inside WWU folder which will contain some necessary images files. I tried doing so using below code but I am unable to get folder being created.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="{AADE647C-36C5-48A7-A88F-5AB8D6BAE7FE}" Name="WWU 1.0" Language="1033" Version="1.0.0.0" Manufacturer="Aricent Group" UpgradeCode="f89a1900-bdb0-4fec-a035-e69ae882716b">
<Package Id="*" Keywords="Installer" Description="Aricent's WWU 1.0 Installer" Comments="WWU is a registered trademark of Aricent Group." Manufacturer="Aricent Group" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<UIRef Id="WixUI_Minimal"/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.WWU_UI.TargetDir)License.rtf"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id= "1" Cabinet="WWU.cab" EmbedCab="yes"/>
<Feature Id="Complete" Title="WWU`_Installer" Description="The complete package." Display="expand" ConfigurableDirectory="INSTALLFOLDER" Level="1">
<ComponentGroupRef Id="ProductComponents"/>
<ComponentGroupRef Id="Shortcuts"/>
</Feature>
<Feature Id="ImagePack" Title="Images" Level="1">
<ComponentGroupRef Id="ImageFiles"/>
</Feature>
</Product>
<Fragment>
<UI>
<Dialog Id="UserRegistrationDlg" Width="360" Height="250" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="NameLabel" Type="Text" X="45" Y="70" Width="100" Height="15" TabSkip="no" Text="User Name:"/>
<Control Id="NameEdit" Type="Text" X="45" Y="80" Width="220" Height="18" Property="USERNAME" Text="{80}" />
<Control Id="OrganizationalLabel" Type="Text" X="45" Y="110" Width="100" Height="15" TabSkip="no" Text="Organization:"/>
</Dialog>
</UI>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="WWU" />
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="WWU 1.0" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
<Directory Id="ImageFolder" Name="image"/>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="MainExecutable" Guid="{434D54CC-D875-4B45-8125-CCCB8119A053}">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<File Id="WWUEXE" Name="WWU_UI.exe" Source="$(var.WWU_UI.TargetDir)WWU_UI.exe" KeyPath="yes">
<Shortcut Id="startmenuWWU" Directory="ProgramMenuDir" Name="WWU Tutorial 1.0" WorkingDirectory="IINSTALLDIR" Icon="WWU_UI.exe" Advertise="yes"/>
<Shortcut Id="desktopWWU" Directory="DesktopFolder" Name="WWU Tutorial 1.0" WorkingDirectory="IINSTALLDIR" Icon="WWU_UI.exe" Advertise="yes"/>
</File>
</Component>
<Component Id="SQLiteInterop" Guid="{7DBF7C38-3001-403F-911E-AF3C318F6219}">
<File Id="Interopdll" Name="SQLite.Interop.dll" Source="$(var.WWU_UI.TargetDir)x86\SQLite.Interop.dll" />
</Component>
<Component Id="SQLitedll" Guid="{DB1FB7CC-6D89-478B-9276-8F4F987027AC}" >
<File Id="SQLite" Name="System.Data.SQLite.dll" Source="$(var.WWU_UI.TargetDir)System.Data.SQLite.dll" />
</Component>
<Component Id="SQLiteLinqdll" Guid="{C65A7DD8-6F1A-4E02-86B2-2B2EDFFDD684}" >
<File Id="SQLiteLinq" Name="System.Data.SQLite.Linq.dll" Source="$(var.WWU_UI.TargetDir)System.Data.SQLite.Linq.dll" />
</Component>
<Component Id="Log4net" Guid="{5266C74E-D7F8-4091-90C2-B661A63B7909}" >
<File Id="Log4netdll" Name="log4net.dll" Source="$(var.WWU_UI.TargetDir)log4net.dll" />
</Component>
</ComponentGroup>
<ComponentGroup Id="Shortcuts" Directory="ProgramMenuDir">
<Component Id="ProgramMenuShortcut">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
</Component>
</ComponentGroup>
<!-- image files for image folder -->
<ComponentGroup Id="ImageFiles" Directory="ImageFolder">
<Component Id="Asfo" Guid="{B8031331-076F-4C75-B231-3EBCBBD8D29C}">
<File Id="Asfoimg" Name="0sf0.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\0sfo.ico" />
</Component>
<Component Id="Asfob" Guid="{D0D78785-3CFC-49C7-9470-90250034D331}">
<File Id="Asfobimg" Name="0sfob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\0sfob.ico" />
</Component>
<Component Id="Aufo" Guid="{6912A60F-F612-4AB8-B530-A0EA71AF8587}">
<File Id="Aufoimg" Name="0ufo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\0ufo.ico" />
</Component>
<Component Id="Aufob" Guid="{AD38A28F-3518-4AA4-B169-EC5077844E83}">
<File Id="Aufobimg" Name="0ufob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\0ufob.ico" />
</Component>
<Component Id="Bsfo" Guid="{D9A2BD2E-70C2-47DE-8B20-501A9D77A3CD}">
<File Id="Bsfoimg" Name="1sfo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\1sfo.ico" />
</Component>
<Component Id="Bsfob" Guid="{AC063280-4698-4605-B74C-471DEAD9D595}">
<File Id="Bsfobimg" Name="1sfob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\1sfob.ico" />
</Component>
<Component Id="Bufo" Guid="{0D840A42-3119-4283-9220-BCD722FA4D31}">
<File Id="Bufoimg" Name="1ufo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\1ufo.ico" />
</Component>
<Component Id="Bufob" Guid="{A8425CC9-5787-419D-8D37-8B6F16726C84}">
<File Id="Bufobimg" Name="1ufob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\1ufob.ico" />
</Component>
<Component Id="Csfo" Guid="{CBB6870F-3FBA-4ADC-B508-D865A8642C19}">
<File Id="Csfoimg" Name="2sfo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\2sfo.ico" />
</Component>
<Component Id="Csfob" Guid="{E0EBE823-11EB-4054-A544-1F9859D06A00}">
<File Id="Csfobimg" Name="2sfob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\2sfob.ico" />
</Component>
<Component Id="Cufo" Guid="{E1870A35-B398-4B4A-AC1C-0A701A5188F8}">
<File Id="Cufoimg" Name="2ufo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\2ufo.ico" />
</Component>
<Component Id="Cufob" Guid="{3A6EA0AE-38C0-496C-B977-3342F3C6D8B8}">
<File Id="Cufobimg" Name="2ufob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\2ufob.ico" />
</Component>
<Component Id="Dsfo" Guid="{2D575CA7-96DA-40A1-B1EC-173F455E47C4}">
<File Id="Dsfoimg" Name="3sfo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\3sfo.ico" />
</Component>
<Component Id="Dsfob" Guid="{C08977BB-8FF7-459F-B3B3-8A9E75152EF5}">
<File Id="Dsfobimg" Name="3sfob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\3sfob.ico" />
</Component>
<Component Id="Dufo" Guid="{552B1B41-247D-490B-9433-B642CAD6A70A}">
<File Id="Dufoimg" Name="3ufo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\3ufo.ico" />
</Component>
<Component Id="Dufob" Guid="{3140C586-45C8-4496-BADD-3F55D9F2B751}">
<File Id="Dufobimg" Name="3ufob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\3ufob.ico" />
</Component>
<Component Id="Esfo" Guid="{311F89D5-5E53-4B45-87F7-B521ACC6D7C1}">
<File Id="Esfoimg" Name="4sfo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\4sfo.ico" />
</Component>
<Component Id="Esfob" Guid="{E9239C1D-3F5A-497B-92D4-0830E739A5E9}">
<File Id="Esfobimg" Name="4sfob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\4sfob.ico" />
</Component>
<Component Id="Eufo" Guid="{8A057476-D9B3-4033-9906-567377D97304}">
<File Id="Eufoimg" Name="4ufo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\4ufo.ico" />
</Component>
<Component Id="Eufob" Guid="{8CE17A52-19B1-4FB6-9D12-0B231E3DDE4D}">
<File Id="Eufobimg" Name="4ufob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\4ufob.ico" />
</Component>
<Component Id="Fsfo" Guid="{D0433C83-BCC5-41EB-8015-9D76E4457448}">
<File Id="Fsfoimg" Name="5sfo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\5sfo.ico" />
</Component>
<Component Id="Fsfob" Guid="{C65BD8E6-C9F1-4A75-9A23-3A6DB35B4BFC}">
<File Id="Fsfobimg" Name="5sfob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\5sfob.ico" />
</Component>
<Component Id="Fufo" Guid="{4F9D5939-7011-4D99-A65B-3F0A2130622B}">
<File Id="Fufoimg" Name="5ufo.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\5ufo.ico" />
</Component>
<Component Id="Fufob" Guid="{90D7B520-4A37-42AC-AB62-F5485A89FCC9}">
<File Id="Fufobimg" Name="5ufob.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\5ufob.ico" />
</Component>
<Component Id="Ari_WWU" Guid="{086B969B-BAA2-4DFA-B699-F56FF885AB26}">
<File Id="Ari_WWUimg" Name="Ari_WWU.ico" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\Ari_WWU.ico" />
</Component>
<Component Id="auto" Guid="{9625F82B-B206-40E6-9310-8D46563E20C6}">
<File Id="auto" Name="auto.png" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\auto.png" />
</Component>
<Component Id="info" Guid="{DDCBB410-77DD-49C9-9372-98DD2747121E}">
<File Id="infoimg" Name="info.png" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\info.png" />
</Component>
<Component Id="manual" Guid="{4F8768A8-E44C-4781-9680-95CAC631CFB7}">
<File Id="manualimg" Name="manual.png" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\manual.png" />
</Component>
<Component Id="off" Guid="{702551D4-34DD-4B1B-B4F6-614DEFA4542A}">
<File Id="offimg" Name="off.png" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\off.png" />
</Component>
<Component Id="on" Guid="{7682A68D-712B-4F70-9EE2-FB4F0E04947D}">
<File Id="onimg" Name="on.png" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\on.png" />
</Component>
<Component Id="refresh" Guid="{9815CA13-659C-466D-B759-5EF557069D1B}">
<File Id="refreshimg" Name="refresh.png" KeyPath="yes" Source="$(var.WWU_UI.TargetDir)image\refresh.png" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<Icon Id="WWU_UI.exe" SourceFile="$(var.WWU_UI.TargetDir)WWU_UI.exe"/>
</Fragment>
</Wix>
You should nest the <Directory Id="ImageFolder"> under <Directory Id="INSTALLFOLDER">, like this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="WWU">
<Directory Id="ImageFolder" Name="image"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="WWU 1.0" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
Note also that if there's no component in that folder, the empty directory won't be created. In order for this to happen, you'll have to author a component with <CreateFolder> element in it.
This is what you do.
Nest the subfolder underneath INSTALLFOLDER as stated by Yan.
Create the Feature Component with the CreateFolder bit inside
Example code:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="WixInstallerExample" >
<Directory Id="test" Name="AnotherDirectory">
<Component Id="test" Guid="e29f1a9e-3ede-40d6-aba0-bfe451002ee3"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no" Win64="no" Location="either">
<CreateFolder/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="test" Title="testfolder" Level="1">
<ComponentRef Id="test"/>
</Feature>
</Fragment>