Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code snippets; more Markdown, less HTML #231

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ File versions are determined using the [Property](../../xsd/wix/property.md), [D

```xml
<Property Id="USER32VERSION">
<DirectorySearch Id="SystemFolderDriverVersion" Path="[SystemFolder]">
<FileSearch Name="user32.dll" MinVersion="6.0.6001.1750"/>
</DirectorySearch>
<DirectorySearch Id="SystemFolderDriverVersion" Path="[SystemFolder]">
<FileSearch Name="user32.dll" MinVersion="6.0.6001.1750"/>
</DirectorySearch>
</Property>
```

Expand All @@ -26,7 +26,7 @@ Once you have determined whether the file exists with the requested version you

```xml
<Condition Message="The installed version of user32.dll is not high enough to support this installer.">
<![CDATA[Installed OR USER32VERSION]]>
<![CDATA[Installed OR USER32VERSION]]>
</Condition>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you are using WiX in Visual Studio you can add the extensions using the Add R
## Step 2: Add the WiX Utility extensions namespace to your project
Once the library is added to your project, you need to add the Utility extensions namespace to your project so you can access the appropriate WiX elements. To do this modify the top-level [Wix](../../xsd/wix/wix/wix.md) element in your project by adding the following attribute:

```
```xml
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
# How To: Reference another DirectorySearch element

There may be times when you need to locate different files or subdirectories under the same directory, and assign each to a separate property. Since you cannot define the same DirectorySearch element more than once, you must use a DirectorySearchRef element.
To reference another DirectorySearch element, you must specify the same Id,
Parent Id, and Path attribute values or you will get unresolved symbol errors
when linking with light.exe.
There may be times when you need to locate different files or subdirectories under the same directory, and assign each to a separate property. Since you cannot define the same DirectorySearch element more than once, you must use a DirectorySearchRef element. To reference another DirectorySearch element, you must specify the same Id, Parent Id, and Path attribute values or you will get unresolved symbol errors when linking with light.exe.

## Step 1: Define a DirectorySearch element

You first need to define the parent DirectorySearch element. This is expected to
contain the different files or subdirectories you will assign to separate
properties.
You first need to define the parent DirectorySearch element. This is expected to contain the different files or subdirectories you will assign to separate properties.

```
<span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">Property </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">SHDOCVW</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">WinDir</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">[WindowsFolder]</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Media</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Media</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">FileSearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Chimes</span>" <span style="COLOR: red">Name</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">chimes.wav</span>" <span style="COLOR: blue">/&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">Property</span><span style="COLOR: blue">&gt;</span>
```xml
<Property Id="SHDOCVW">
<DirectorySearch Id="WinDir" Path="[WindowsFolder]">
<DirectorySearch Id="Media" Path="Media">
<FileSearch Id="Chimes" Name="chimes.wav" />
</DirectorySearch>
</DirectorySearch>
</Property>
```

This will search for the file &quot;chimes.wav&quot; under the Media directory in Windows.
If the file is found, the full path will be assigned to the public property
&quot;SHDOCVW&quot;.
This will search for the file "chimes.wav" under the Media directory in Windows. If the file is found, the full path will be assigned to the public property "SHDOCVW".

## Step 2: Define a DirectorySearchRef element

To search for another file in the Media directory, you need to reference all the
same Id, Parent Id, and Path attributes. Because the Media DirectorySearch
element is nested under the WinDir DirectorySearch element, its Parent attribute is automatically assigned the parent DirectorySearch element&apos;s Id attribute value; thus, that is what you must specify for the DirectorySearchRef element&apos;s Parent attribute value.
To search for another file in the Media directory, you need to reference all the same Id, Parent Id, and Path attributes. Because the Media DirectorySearch element is nested under the WinDir DirectorySearch element, its Parent attribute is automatically assigned the parent DirectorySearch elements Id attribute value; thus, that is what you must specify for the DirectorySearchRef element's Parent attribute value.

```
<span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">Property </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">USER32</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearchRef </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Media</span>" <span style="COLOR: red">Parent</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">WinDir</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Media</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">FileSearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Chord</span>" <span style="COLOR: red">Name</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">chord.wav</span>" <span style="COLOR: blue">/&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearchRef</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">Property</span><span style="COLOR: blue">&gt;</span>
```xml
<Property Id="USER32">
<DirectorySearchRef Id="Media" Parent="WinDir" Path="Media">
<FileSearch Id="Chord" Name="chord.wav" />
</DirectorySearchRef>
</Property>
```

If you wanted to refer to another DirectorySearch element that used the Id Media
but was under a different parent path, you would have to define a new
DirectorySearch element under a different parent than in step 1.
If you wanted to refer to another DirectorySearch element that used the Id Media but was under a different parent path, you would have to define a new DirectorySearch element under a different parent than in step 1.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you are using WiX in Visual Studio you can add the extensions using the Add R
## Step 2: Add the WiX .NET extensions namespace to your project
Once the library is added to your project you need to add the .NET extensions namespace to your project so you can access the appropriate WiX elements. To do this modify the top-level [Wix](../../xsd/wix/wix/wix.md) element in your project by adding the following attribute:

```
```xml
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,31 @@ You can set a property to the parent directory of a file.

## Step 1: Define the search root

In the following example, the path to [WindowsFolder]Microsoft.NET is defined as the root of the search. If you do not define a search root, Windows Installer will search all fixed drives up to the depth specified.
In the following example, the path to \[WindowsFolder\]Microsoft.NET is defined as the root of the search. If you do not define a search root, Windows Installer will search all fixed drives up to the depth specified.

```
<span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">Property </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">NGEN2DIR</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Windows</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">[WindowsFolder]</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">MS.NET</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Microsoft.NET</span>"<span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">Property</span><span style="COLOR: blue">&gt;</span>
```xml
<Property Id="NGEN2DIR">
<DirectorySearch Id="Windows" Path="[WindowsFolder]">
<DirectorySearch Id="MS.NET" Path="Microsoft.NET">
</DirectorySearch>
</DirectorySearch>
</Property>
```

## Step 2: Define the parent directory to find
Under the search root, define the directory you want returned and set the DirectorySearch/@AssignToProperty attribute to &apos;yes&apos;. You must then define the file you want to find using a unique FileSearch/@Id attribute value.

```
<span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">Property </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">NGEN2DIR</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Windows</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">[WindowsFolder]</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">MS.NET</span>" <span style="COLOR: red">Path</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Microsoft.NET</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">DirectorySearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Ngen2Dir</span>" <span style="COLOR: red">Depth</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">2</span>" <span style="COLOR: red">AssignToProperty</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">yes</span>"<span style="COLOR: blue">&gt;
&lt;</span><span style="COLOR: #a31515">FileSearch </span><span style="COLOR: red">Id</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Ngen_exe</span>" <span style="COLOR: red">Name</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">ngen.exe</span>" <span style="COLOR: red">MinVersion</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">2.0.0.0</span>" <span style="COLOR: blue">/&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">DirectorySearch</span><span style="COLOR: blue">&gt;
&lt;/</span><span style="COLOR: #a31515">Property</span><span style="COLOR: blue">&gt;</span>
Under the search root, define the directory you want returned and set the DirectorySearch/@AssignToProperty attribute to 'yes'. You must then define the file you want to find using a unique FileSearch/@Id attribute value.

```xml
<Property Id="NGEN2DIR">
<DirectorySearch Id="Windows" Path="[WindowsFolder]">
<DirectorySearch Id="MS.NET" Path="Microsoft.NET">
<DirectorySearch Id="Ngen2Dir" Depth="2" AssignToProperty="yes">
<FileSearch Id="Ngen_exe" Name="ngen.exe" MinVersion="2.0.0.0" />
</DirectorySearch>
</DirectorySearch>
</DirectorySearch>
</Property>
```

In this example, if ngen.exe is newer than version 2.0.0.0 and is found no more than two directories under [WindowsFolder]Microsoft.NET its parent directory is returned in the NGEN2DIR property.
In this example, if ngen.exe is newer than version 2.0.0.0 and is found no more than two directories under \[WindowsFolder\]Microsoft.NET its parent directory is returned in the NGEN2DIR property.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ To use a WiX extension when building in Visual Studio with the WiX Visual Studio

To enable IntelliSense for a WiX extension in the Visual Studio IDE, you need to add an XMLNS declaration to the &lt;Wix&gt; element in your .wxs file. For example, if you want to use the NativeImage functionality in the WixNetFxExtension, the &lt;Wix&gt; element would look like the following:

```xml
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
```

After adding this, you can add an element named &lt;netfx:NativeImage/&gt; and view IntelliSense for the attributes supported by the NativeImage element.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ and prefix the element name with the `util` prefix:
SecondFailureActionType="restart"
ThirdFailureActionType="restart" />
</ServiceInstall>
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ WiX provides two ways of speeding up the creation of cabinets for compressing fi

## Multithreaded cabinet creation

Light uses multiple threads to build multiple cabinets in a single package. Unfortunately, because the CAB API itself isn&apos;t multithreaded, a single cabinet is built with one thread. Light uses multiple threads when there are multiple cabinets, so each cabinet is built on one thread.
Light uses multiple threads to build multiple cabinets in a single package. Unfortunately, because the CAB API itself isn't multithreaded, a single cabinet is built with one thread. Light uses multiple threads when there are multiple cabinets, so each cabinet is built on one thread.

By default, Light uses the number of processors/cores in the system as the number of threads to use when creating cabinets. You can override the default using Light&apos;s -ct switch or the CabinetCreationThreadCount property in a .wixproj project.
By default, Light uses the number of processors/cores in the system as the number of threads to use when creating cabinets. You can override the default using Light's -ct switch or the CabinetCreationThreadCount property in a .wixproj project.

You can use multiple cabinets both externally and embedded in the .msi package (using the [Media/@EmbedCab](../../xsd/wix/media.md) attribute).

## Cabinet reuse

If you build setups with files that don&apos;t change often, you can generate cabinets for those files once, then reuse them without spending the CPU time to re-build and re-compress them.
If you build setups with files that don't change often, you can generate cabinets for those files once, then reuse them without spending the CPU time to re-build and re-compress them.

There are two Light.exe switches involved in cabinet reuse:

<dl>
<dt><dfn>-cc (CabinetCachePath property in .wixproj projects)</dfn><dd>The value is the path to use to both write new cabinets and, when -reusecab/ReuseCabinetCache is specified, look for cached cabinets.</dd></dt>
<dt><dfn>-reusecab (ReuseCabinetCache property in .wixproj projects)</dfn><dd>When -cc/CabinetCachePath is also specified, WiX reuses cabinets that don&apos;t need to be rebuilt.</dd></dt>
<dt><dfn>-reusecab (ReuseCabinetCache property in .wixproj projects)</dfn><dd>When -cc/CabinetCachePath is also specified, WiX reuses cabinets that don't need to be rebuilt.</dd></dt>
</dl>

WiX automatically validates that a cached cabinet is still valid by ensuring that:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# How To: Specify source files

WiX provides three ways of identifying a setup package&apos;s payload - the files
that are included in the setup and installed on the user&apos;s machine.
WiX provides three ways of identifying a setup package's payload - the files
that are included in the setup and installed on the user's machine.

* By file name and directory tree.
* By explicit source file.
Expand All @@ -21,7 +21,7 @@ containing them or copies them to an uncompressed layout.

You can provide the binder with one or more *binder input paths*
it uses to look for files. It also looks for files relative to the current
working directory. Light.exe&apos;s -b switch and the BindInputPaths .wixproj
working directory. Light.exe's -b switch and the BindInputPaths .wixproj
property let you specify one or more binder input paths.

Binder input paths can also be prefixed with a *name* which will
Expand All @@ -32,15 +32,17 @@ an example in the *Identifying payload via named binder paths* section

## Identifying files by name and directory tree
When you use the [File](../../xsd/wix/file.md)/@Name
attribute and don&apos;t use the File/@Source attribute, the compiler constructs an
implicit path to the file based on the file&apos;s parent component directory plus
attribute and don't use the File/@Source attribute, the compiler constructs an
implicit path to the file based on the file's parent component directory plus
the name you supply. So, for example, given the partial authoring

```xml
<Directory Id="TARGETDIR">
<Directory Name="foo">
<Directory Name="bar">
<Component>
<File Name="baz.txt" />
```

the binder looks for a file *foo\bar\baz.txt* in the unnamed binder
input paths.
Expand All @@ -52,19 +54,20 @@ and [DirectoryRef](../../xsd/wix/directoryref.md)
elements sets a new directory for files in that directory or any child
directories. For example, given the partial authoring


```xml
<Directory Id="TARGETDIR">
<Directory Name="foo" FileSource="build\retail\x86">
<Directory Name="bar">
<Component>
<File Name="baz.txt" />
```

the binder looks for a file *build\retail\x86\bar\baz.txt* in the
unnamed binder input paths.

The [FileSource](../../xsd/wix/directoryref.md)
attribute can use preprocessor variables or environment variables. If the value
is an absolute path, the binder&apos;s unnamed input paths aren&apos;t used.
is an absolute path, the binder's unnamed input paths aren't used.

#### Preferred use
If the build tree serving as your payload source is almost identical to the
Expand All @@ -88,7 +91,7 @@ automatically sets it to the filename portion of the source path.
#### Preferred use
If the build tree serving as your payload source is different from the tree
of your installed image, using File/@Source makes it easy to pick explicit
paths than are different than the .msi package&apos;s directory tree. You can use
paths than are different than the .msi package's directory tree. You can use
multiple unnamed binder input paths to shorten the File/@Source paths.

For example, the WiX setup .wixproj project points to the output tree for
Expand Down
Loading