I have a defines.wxi-file which contains some good definitions used in all my wxs-files.
When I attempt to reference the defined value from one of the <Fragment>-files I get Undefined preprocessor variable '$(var.IMAGE_FOLDER)' back in my face.
I guess there is something trivial I am missing here...
Any ideas?
Edit 19:th April.
Found that issue only occurs if reference from a Fragment-file.
Re-wrote sample to match that.
defines.wxi
<Include>
<?define IMAGE_FOLDER="Images" ?>
</Include>
some-Fragment.wxs
<Fragment>
<?Include defines.wxi ?>
<Component Id='c.Images' Guid=".." Directory='INSTALLDIR.Images' >
<File Id='f.sample.jpg' Source='$(var.IMAGE_FOLDER)sample.jpg' Name='sample.jpg' />
</Component>
Solved it.
Where it in the sample says:
<?Include defines.wxi ?>
it should be lower case...
<?include defines.wxi ?>
then it works like a charm!
/L
Ok, another try.
Do you reference anything in that <Fragment/> from the main <Product/> ? The contents of the fragment are visible to the rest of the code in case you reference anything from it. For instance, you can reference a component (<ComponentRef/>) or component group (<ComponentGroupRef/>). Once anything is referenced, the entire fragment is included.
Hope this helps.
In the text of the error message you provided it says "Undefined preprocessor variable '$(var.MAGE_FOLDER)'", not $(var.IMAGE_FOLDER) - the leading 'I' is missing. This made me think that you reference the same variable somewhere in the rest of your code, but misspelling it.
In this case, the candle.exe is absolutely right - it can find IMAGE_FOLDER, but can't find MAGE_FOLDER.
Hope this is the case and you'll fix it quickly. ;-)
Related
i am trying to set a value in WIX XmlConfig which contains curly brackets
I want to set a value like this "IndexServer__%property{name}.zip"
<util:XmlFile
Id="AppConfigLocalFileDebugLogPath"
Action="setValue"
Permanent="yes"
ElementPath="//configuration/log4net/appender[\[]#name='LocalFileDebugLog'[\]]/file/#value"
Value="[LOGFILEROOTPATH]\IndexServer\Debug\IndexServer_DEBUG__%property[\{]index-name[\}].log"
File="[INSTALLFOLDER]Index.Webservice.exe.config"
SelectionLanguage="XPath"
Sequence="1"
/>
I thought it could work with [{] and [}] because [[] and []] works fine but it doesnt. I get following error from HEAT"HEAT5055: Error applying transform xxxxx to harvested Wix: unexpected token ']' in expression"
(or something like that, the original error message is in german ;-) )
If i simply try:
<util:XmlFile
Id="AppConfigLocalFileDebugLogPath"
Action="setValue"
Permanent="yes"
ElementPath="//configuration/log4net/appender[\[]#name='LocalFileDebugLog'[\]]/file/#value"
Value="[LOGFILEROOTPATH]\IndexServer\Debug\IndexServer_DEBUG__%property{index-name}.log"
File="[INSTALLFOLDER]Index.Webservice.exe.config"
SelectionLanguage="XPath"
Sequence="1"
/>
This results in a string like "E:\LogFiles\WSIndexServer\WSIndexServer__%property.log" as you can see the string "{index-name}" gets lost ;-(
Could you help me here? I need the part "{index-name}" including the curly brackets in the string.
Thanks a lot
Chris
As the question is tagged as XSLT and as you say that with Value="[LOGFILEROOTPATH]\IndexServer\Debug\IndexServer_DEBUG__%property{index-name}.log" the {index-name} is lost I suppose that value is evaluated in XSLT and you need to double the {} to avoid being treated as an attribute value template, so try Value="[LOGFILEROOTPATH]\IndexServer\Debug\IndexServer_DEBUG__%property{{index-name}}.log".
One of my goals in creating the bootstrap project is to set a default log location. I would like the location to be based on the local app data folder. I cannot figure out how to reference the builtin Burn variable LocalAppDataFolder. I have found information about how to reference these variables in code, but not in the xml.
The reference to the property looks like this:
<MsiPackage SourceFile="MyInstaller.msi" LogPathVariable="[LogLocation]" />
The property is set like this:
<Variable Name="LogLocation" Value="[LocalAppDataFolder]MyLogFolder\Setup" Type="string"/>
The log output shows:
Initializing string variable 'LogLocation' to value
'[LocalAppDataFolder]MyLogFolder\Setup'
What am I missing to resolve [LocalAppDataFolder] ?
thanks in advance.
It's normal for the log output to show the un-formatted value, so that part looks correct. I think what you are missing is LogPathVariable should be specified without the brackets.
<MsiPackage SourceFile="MyInstaller.msi" LogPathVariable="LogLocation" />
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
Referenced file contains errors (http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd). For more information, right click on the message in the Problems View and select "Show Details..."
The errors below were detected when validating the file "web-app_2_5.xsd" via the file "web.xml". In most cases these errors can be detected by validating "web-app_2_5.xsd" directly. However it is possible that errors will only occur when web-app_2_5.xsd is validated in the context of web.xml.
In details, I see a bunch of these:
s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than xs:appinfo and xs:documentation. Saw 'var _U="undefined";'
If you replace j2ee by javaee, it will work fine.
EDIT :
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Edit:
To know anything further related to this error. Please follow the Link. Here you will find schemas for Java EE deployment descriptors (web.xml).
replace
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
with
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee;http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
The solution is that you have to put semicolon between URLs
I am sure you will not get the error again :)
I suggest you add ; between 2 passages:
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee and http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Like this:
:xsi:schemaLocation="http://java.sun.com/xml/ns/javaee;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Add semicolon between xsi:schemaLocation just as shown below
"http://java.sun.com/xml/ns/javaee;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
This resolved my this error in <servlet-name> tag line as well.
"cvc-id.3: A field of identity constraint 'web-common-servlet-name-uniqueness' matched element 'web-app', but this element does not have a simple type."
In my case, I had replaced
xsi:schemaLocation="http://java.sun.com/../.."
with
xsi:schemaLocation="http://xmlns.jcp.org/../.."
Cheers!
On the surface it appears that the schemaLocation is wrong. Resolving it appears to redirect to a HTML page rather than a XSD schema.
I would suggest simply removing this line unless you really want to do XSD validation at runtime. Bear in mind the relevant parts will be validated by your servlet container.
Replacing the schemaLocation as below has resovled the error for me:
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/j2ee; http://xmlns.jcp.org/xml/ns/j2ee/web-app_2_4.xsd"
I want to set a property in a custom action and use it in the standard custom action "util:User" afterwards. But no matter where I put the property in my wxs-file, I always get "error LGHT0094 : Unresolved reference to symbol"
Details:
In my setup I want to add a new user by using util:User. The user should be added to the group "Power Users" by using util:GroupRef. No Problem so far. Unfortunately the group names are language dependent. In german "Power Users" is "Hauptbenutzer". So I want to look up the well known SID S-1-5-32-547 in a custom action, set a property in this custom action by calling MsiSetProperty and then use the property for util:GroupRef.
As far as I understand, the property must be declared somewhere in the wxs-file.
In the examples I found, the property was never declared as follows (but I also tried that):
<Property Id="TextSID" Value="Power Users" />
In the examples there always was a custom action to set the property, like:
<CustomAction Id="SetTextSID"
Property="TextSID"
Value="Power Users"
Return="check" />
My problem is, that the creation of the user fails to "compile" because the property "TextSID" is not known:
<Component Id="CreateUser" Guid="Some GUID here in my original wxs file">
<util:User Id="UserUser"
Name="User" Password="Password"
CanNotChangePassword="yes" PasswordNeverExpires="yes">
<util:GroupRef Id="TextSID" />
</util:User>
</Component>
I have never done a custom action before and I'm a new to WiX and MSI, so any idea would be very welcome.
Regards
Ralf
Sorry for wasting your time.
I stared at my XML for hours before I posted this question, just to find the answer immediately after my post :-(
My only problem was, that it is not possible to reference to something that isn't there. In this case the "util:Group" was missing.
I am adding elements to an XML file during installation using the XmlFile element:
<util:XmlFile Id="SetOracleDialectProperty"
Action="createElement"
ElementPath="//hibernate-configuration/session-factory"
Name="property"
Sequence="9"
File="[INSTALLLOCATION]Config\hibernate.config"
Value="NHibernate.Dialect.Oracle10gDialect"/>
The empty file I am writing to looks like this:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
</session-factory>
</hibernate-configuration>
After running the installer I end up with this:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property xmlns="">NHibernate.Dialect.Oracle10gDialect</property>
</session-factory>
</hibernate-configuration>
The problem is that the empty xmlns attribute is overriding the xmlns specified in the root node of the file so the property element is not recognised correctly by nhibernate.
How can I either set the value to match the root node or remove the xmlns attribute?
I have spent some time searching for an answer and the closest I've found is "do what you would do in MSXML" which doesn't help me as it doesn't say how to do it in WiX (e.g. what attribute on XmlFile to use).
EDIT
To explain Rob's answer slightly, in a place where I can use nice formatting:
You add a document fragment by setting Node="document" on the XmlConfig element.
You have to explicitly set the namespace otherwise you get the default one again.
Also although you're adding a "document" it doesn't seem to work if you specify more than one element. You get a mysterious and thoroughly unhelpful "Setup wizard ended prematurely" runtime error.
So my fixed code looks like this:
<util:XmlConfig Id="MsSqlDialect"
Action="create"
ElementPath="//hibernate-configuration/session-factory"
File="[INSTALLLOCATION]Config\hibernate.config"
Node="document">
<![CDATA[
<property xmlns="urn:nhibernate-configuration-2.2" name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
]]>
</util:XmlConfig>
I know this is years later but if anyone else comes across this I think the true solution is this:
<util:XmlFile Id="SetOracleDialectProperty"
Action="createElement"
ElementPath="//hibernate-configuration/session-factory"
Name="urn:nhibernate-configuration-2.2:property"
Sequence="9"
File="[INSTALLLOCATION]Config\hibernate.config"
Value="NHibernate.Dialect.Oracle10gDialect"/>
change is from Name="property" to Name="urn:nhibernate-configuration-2.2:property" - when config is written it will apprear as just as it will recognize it is the default namespace. I had the same problem adjusting manifest files and this approach sorted it.
The problem here is that MSXML states that createElement will always give you the default namespace (just as you are seeing). I think you'll need to switch to the more complex but more powerful XmlConfig. In this case, try using a document fragment to add the entire element with correct namespace instead of depending on MSXML to create it for you.