Skip to content

Commit 3c92ee4

Browse files
ryfu-msftRyan Fu
andauthored
update configuration example and wingetconfigroot variable (#3686)
Co-authored-by: Ryan Fu <[email protected]>
1 parent 1041e6d commit 3c92ee4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

hub/package-manager/configuration/create.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,41 +56,38 @@ The following is an example WinGet Configuration `configuration.dsc.yaml` format
5656
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
5757
properties:
5858
assertions:
59-
- resource: OsVersion
59+
- resource: Microsoft.Windows.Developer/OsVersion
6060
directives:
6161
description: Verify min OS version requirement
62-
module: Microsoft.Windows.Developer
6362
allowPrerelease: true
6463
settings:
65-
MinVersion: "10.0.19041"
64+
MinVersion: '10.0.22000'
6665
resources:
67-
- resource: DeveloperMode
66+
- resource: Microsoft.Windows.Developer/DeveloperMode
6867
directives:
6968
description: Enable Developer Mode
70-
module: Microsoft.Windows.Developer
7169
allowPrerelease: true
7270
settings:
7371
Ensure: Present
74-
- resource: WinGetPackage
72+
- resource: Microsoft.WinGet.DSC/WinGetPackage
7573
id: vsPackage
7674
directives:
7775
description: Install Visual Studio 2022 Community
78-
module: Microsoft.WinGet.DSC
7976
allowPrerelease: true
8077
settings:
8178
id: Microsoft.VisualStudio.2022.Community
8279
source: winget
83-
- resource: InstallVSConfig
80+
- resource: Microsoft.VisualStudio.DSC/VSComponents
8481
dependsOn:
8582
- vsPackage
8683
directives:
87-
description: Install required VS workloads
88-
module: Microsoft.VisualStudio.DSC
84+
description: Install required VS workloads from vsconfig file
8985
allowPrerelease: true
9086
settings:
9187
productId: Microsoft.VisualStudio.Product.Community
9288
channelId: VisualStudio.17.Release
93-
vsconfigFile: ${WinGetConfigRoot}\..\.vsconfig
89+
vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig'
90+
includeRecommended: true
9491
configurationVersion: 0.2.0
9592
```
9693
@@ -102,9 +99,9 @@ The components of this file consist of:
10299

103100
3. **Assertions**: List the preconditions (or prerequisites) required for this configuration in this section.
104101

105-
4. **Resource**: Both the "Assertions" and "Resources" list sections consist of individual `resource` nodes to represent the set up task. The `resource` should be given a name to represent the set up task that it will accomplish. Each resource must include **directives** and **settings**. Optionally, it can also include an **id** value.
102+
4. **Resource**: Both the "Assertions" and "Resources" list sections consist of individual `resource` nodes to represent the set up task. The `resource` should be given the name of the PowerShell module followed by the name of the module's DSC resource that will be invoked to apply your desired state: `{ModuleName}/{DscResource}`. Each resource must include **directives** and **settings**. Optionally, it can also include an **id** value. When applying a configuration, WinGet will know to install the module from the [PowerShell Gallery](https://www.powershellgallery.com/packages) and invoke the specified [DSC resource](/powershell/dsc/concepts/resources).
106103

107-
5. **Directives**: The `directives` value of a resource must include a **module** value, representing the PowerShell module containing the [DSC Resources](/powershell/dsc/concepts/resources) that should be applied to accomplish the desired state configuration task. The `directives` should also include a `description` value to describe the configuration task being accomplished by the module. The `allowPrerelease` value enables you to choose whether or not the configuration will be allowed (`true`) to use "Prerelease" modules from the [PowerShell Gallery](https://www.powershellgallery.com/packages).
104+
5. **Directives**: The `directives` section provides information about the module and the resource. This section should include a `description` value to describe the configuration task being accomplished by the module. The `allowPrerelease` value enables you to choose whether or not the configuration will be allowed (`true`) to use "Prerelease" modules from the [PowerShell Gallery](https://www.powershellgallery.com/packages).
108105

109106
6. **Settings**: The `settings` value of a resource represents the collection of name-value pairs being passed to the PowerShell DSC Resource. Settings could represent anything from whether Developer Mode is enabled, to applying a reg key, or to establishing a particular network setting.
110107

@@ -122,6 +119,9 @@ There are multiple approaches to consider when determining how to organize the R
122119

123120
We recommend including a README.md file with any Open Source published WinGet Configuration file that includes the organizational approach of the file structure.
124121

122+
## Using the variable ${WinGetConfigRoot}
123+
Certain DSC resources may take in a parameter that specifies the path of a file. Instead of specifying the full path, you can use the variable `${WinGetConfigRoot}` to define the working directory where the [`winget configure` command](../winget/configure.md) is being executed and append the relative path to point to that file. This is useful for generalizing a configuration file so that it is machine agnostic. The `Microsoft.VisualStudio.DSC/VSComponents` resource in the example above showcases this functionality by utilizing the `${WinGetConfigRoot}` to point to a .vsconfig file in a project's root directory. This also means that the user should ensure that the target file exists at the relative path based on the current working directory before executing the [`winget configure` command](../winget/configure.md).
124+
125125
## Where to find PowerShell DSC Resource modules
126126

127127
Check out the list of ready-to-use ("inbox") [PowerShell Desired State Configuration Resources](/powershell/dsc/reference/psdscresources/overview#resources) that are supported by Microsoft, including:

0 commit comments

Comments
 (0)