2

I am trying to use Property value in Source attribute of File element, but getting this error:

error LGHT0103 : The system cannot find the file '[MYPROPERTY]'

Here is how property defined and used:

<Property Id="MYPROPERTY" Secure="yes" Value="myfile.xml" />
    ...
<File Id="MyFileId" Name="myfile.xml" Source="SubFolder\[MYPROPERTY]" KeyPath="yes" />

What I am doing wrong?

1 Answer 1

7

The property defined via the property-Tag creates a public property in the MSI-Package which is a Windows Installer concept.

You are refering to this variable in the Source-Attribute of the File-Tag but that isn't the way you can use this property. You can only use them at runtime (e.g. to use them in Registry-Keys you create during the installation) but the Source-Attribut is resolved via compile-time of the package.

The Source-attribut of the File-Tag requires a path to variable that points to a location on the developer machine.

I assume you are looking for Wix precompiler directives:

<?define MyProperty = "C:\myfile.xml" ?>

<File Id="MyFileId" Name="myfile.xml" Source="$(var.MyProperty)" KeyPath="yes" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.