Skip to content
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
17 changes: 9 additions & 8 deletions resources/Help/Microsoft.Dotnet.Dsc/DotNetToolPackage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ The `DotNetToolPackage` DSC Resource allows you to install, update, and uninstal

## PARAMETERS

| **Parameter** | **Attribute** | **DataType** | **Description** | **Allowed Values** |
| ------------------- | ------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `PackageId` | Key | String | The ID of the .NET tool package to manage. | N/A |
| `Version` | Optional | String | The version of the .NET tool package to install. If not specified, the latest version will be installed. | N/A |
| `Commands` | Optional | String[] | An array of commands provided by the .NET tool package. | N/A |
| `Prerelease` | Optional | Boolean | Indicates whether to include prerelease versions of the .NET tool package. The default value is `$false`. | `$true`, `$false` |
| `ToolPathDirectory` | Optional | String | The directory where the .NET tool package will be installed. If not specified, the package will be installed globally. | Use custom directory when you have |
| `Exist` | Optional | Boolean | Indicates whether the package should exist. Defaults to `$true`. | `$true` or `$false` |
| **Parameter** | **Attribute** | **DataType** | **Description** | **Allowed Values** |
| ------------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `PackageId` | Key | String | The ID of the .NET tool package to manage. | N/A |
| `Version` | Optional | String | The version of the .NET tool package to install. If not specified, the latest version will be installed. | N/A |
| `Commands` | Optional | String[] | An array of commands provided by the .NET tool package. | N/A |
| `Prerelease` | Optional | Boolean | Indicates whether to include prerelease versions of the .NET tool package. The default value is `$false`. Note: If the prerelease version is lower than the current version, the highest version will be installed. | `$true`, `$false` |
| `ToolPathDirectory` | Optional | String | The directory where the .NET tool package will be installed. If not specified, the package will be installed globally. | Use custom directory when you have |
| `Exist` | Optional | Boolean | Indicates whether the package should exist. Defaults to `$true`. | `$true` or `$false` |

## EXAMPLES

Expand Down Expand Up @@ -59,4 +59,5 @@ Invoke-DscResource -ModuleName Microsoft.DotNet.Dsc -Name DotNetToolPackage -Met
}

# This example installs the prerelease version of the .NET tool package 'PowerShell' in the 'C:\tools' directory.
# NOTE: When the version in the feed is for example v7.4.5-preview1 and the highest is v7.4.6, the highest will be installed.
```
1 change: 1 addition & 0 deletions resources/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ $DotNetCliPath = Get-DotNetPath
}

This example installs the prerelease version of the .NET tool package 'PowerShell' in the 'C:\tools' directory.
NOTE: When the version in the feed is for example v7.4.5-preview1 and the highest is v7.4.6, the highest will be installed.
#>
[DSCResource()]
class DotNetToolPackage {
Expand Down
4 changes: 2 additions & 2 deletions resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ function Invoke-VSCode {
[string]$Command
)

$stdErrTempFile = "$env:TEMP\$((New-Guid).Guid)"
$stdOutTempFile = "$env:TEMP\$((New-Guid).Guid)"
$stdErrTempFile = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath (New-Guid).Guid
$stdOutTempFile = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath (New-Guid).Guid
$invocationSuccess = $true

$processParams = @{
Expand Down
15 changes: 1 addition & 14 deletions tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@ Describe 'DSC operation capabilities' {
$finalState.Version | Should -Not -BeNullOrEmpty
}

It 'Sets desired package with prerelease' -Skip:(!$IsWindows) {
$parameters = @{
PackageId = 'dotnet-ef'
PreRelease = $true
}

Invoke-DscResource -Name DotNetToolPackage -ModuleName Microsoft.DotNet.Dsc -Method Set -Property $parameters

$finalState = Invoke-DscResource -Name DotNetToolPackage -ModuleName Microsoft.DotNet.Dsc -Method Get -Property $parameters
$finalState.PackageId | Should -Be $parameters.PackageId
$finalState.PreRelease | Should -BeTrue
}

It 'Sets desired package with version' -Skip:(!$IsWindows) {
$parameters = @{
PackageId = 'dotnet-reportgenerator-globaltool'
Expand Down Expand Up @@ -99,7 +86,7 @@ Describe 'DSC operation capabilities' {
It 'Exports resources' -Skip:(!$IsWindows) {
$obj = [DotNetToolPackage]::Export()

$obj.PackageId.Contains('dotnet-ef') | Should -Be $true
$obj.PackageId.Contains('gitversion.tool') | Should -Be $true
$obj.PackageId.Contains('dotnet-reportgenerator-globaltool') | Should -Be $true
}

Expand Down