diff --git a/.vsts-ci.yml b/.vsts-ci.yml
index 02d8fc3..d4844cc 100644
--- a/.vsts-ci.yml
+++ b/.vsts-ci.yml
@@ -26,6 +26,8 @@ resources:
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
+ settings:
+ networkIsolationPolicy: Permissive,CFSClean,CFSClean2
pool:
name: VSEngSS-MicroBuild2022-1ES
sdl:
diff --git a/.vsts-compliance.yml b/.vsts-compliance.yml
index e093f96..9049ea4 100644
--- a/.vsts-compliance.yml
+++ b/.vsts-compliance.yml
@@ -39,6 +39,8 @@ resources:
extends:
template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate
parameters:
+ settings:
+ networkIsolationPolicy: Permissive,CFSClean,CFSClean2
pool:
name: VSEngSS-MicroBuild2022-1ES
sdl:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 875fa48..57feeec 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,6 +17,15 @@ Code analysis and style cop rules are defined for this solution, but are current
If you add any commands please update the `Tags` property of the _VSSetup.nuproj_ project as appropriate. This project is used instead of `Publish-Module` from the _PowerShellGet_ module because it works better with the build systems and can be tested on developer machines without also publishing.
+## Documentation
+
+Cmdlet and `about_` help is authored as markdown under _docs\VSSetup_ and compiled into the checked-in help artifacts under _src\VSSetup.PowerShell\help_. If you change any markdown under _docs\VSSetup_, regenerate these artifacts and check the updated output files in as part of the same pull request:
+
+```powershell
+Install-Module -Name platyPS -Scope CurrentUser -Force
+build\Update-Help.ps1
+```
+
## Building
Before you can build this project from the command line with MSBuild or within Visual Studio, you must restore packages including the [embeddable interop types][interop].
diff --git a/NuGet.config b/NuGet.config
new file mode 100644
index 0000000..15194fc
--- /dev/null
+++ b/NuGet.config
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/build/Update-Help.ps1 b/build/Update-Help.ps1
new file mode 100644
index 0000000..bdf65a9
--- /dev/null
+++ b/build/Update-Help.ps1
@@ -0,0 +1,40 @@
+<#
+.SYNOPSIS
+ Regenerates the checked-in PowerShell help artifacts from the markdown docs.
+
+.DESCRIPTION
+ The official build runs under 1ES network isolation and cannot reach the
+ PowerShell Gallery, so it no longer installs platyPS or runs New-ExternalHelp.
+ Instead, the generated help artifacts are checked in under
+ src\VSSetup.PowerShell\help and copied to the build output by the project.
+
+ Run this script locally (outside the isolated build) whenever the cmdlet or
+ about_ markdown files under docs\VSSetup change, then commit the regenerated
+ files under src\VSSetup.PowerShell\help.
+
+.NOTES
+ Requires the platyPS module. Install it locally with:
+ Install-Module -Name platyPS -Scope CurrentUser -Force
+#>
+[CmdletBinding()]
+param()
+
+$ErrorActionPreference = 'Stop'
+
+$repoRoot = Split-Path -Parent $PSScriptRoot
+$docsPath = Join-Path $repoRoot 'docs\VSSetup'
+$outputPath = Join-Path $repoRoot 'src\VSSetup.PowerShell\help'
+
+if (-not (Get-Module -ListAvailable -Name platyPS)) {
+ throw "platyPS is not installed. Run: Install-Module -Name platyPS -Scope CurrentUser -Force"
+}
+
+Import-Module platyPS
+
+if (-not (Test-Path -Path $outputPath)) {
+ $null = New-Item -Path $outputPath -ItemType Directory
+}
+
+New-ExternalHelp -Path $docsPath -OutputPath $outputPath -Force | Out-Null
+
+Write-Host "Regenerated help artifacts in $outputPath. Review and commit the changes."
diff --git a/build/build.yml b/build/build.yml
index ee9bad4..fa98e24 100644
--- a/build/build.yml
+++ b/build/build.yml
@@ -10,8 +10,12 @@ parameters:
DockerProjectName: microsoft-vssetup-powershell
steps:
+- task: NuGetAuthenticate@1
+ displayName: Authenticate to Azure Artifacts
+
- pwsh: |
- dotnet tool install --tool-path "${env:AGENT_TOOLSDIRECTORY}\nbgv" nbgv
+ dotnet tool install --tool-path "${env:AGENT_TOOLSDIRECTORY}\nbgv" `
+ --configfile "$(Build.SourcesDirectory)\NuGet.config" nbgv
$version = & "${env:AGENT_TOOLSDIRECTORY}\nbgv\nbgv.exe" get-version --variable SemVer1
& "${env:AGENT_TOOLSDIRECTORY}\nbgv\nbgv.exe" cloud --version $version
displayName: Set cloud build version
@@ -21,17 +25,9 @@ steps:
- task: NuGetCommand@2
displayName: Restore nuget packages
-
-- pwsh: |
- Install-Module -Name platyPS -Repository PSGallery -SkipPublisherCheck -Force
- displayName: Install PowerShell modules
-
-- pwsh: |
- New-ExternalHelp -Path docs\VSSetup -OutputPath "src\VSSetup.PowerShell\bin\${env:CONFIGURATION}" -Force
- displayName: Compile documentation
- env:
- CONFIGURATION: ${{ parameters.BuildConfiguration }}
- workingDirectory: $(Build.SourcesDirectory)
+ inputs:
+ feedsToUse: config
+ nugetConfigPath: $(Build.SourcesDirectory)\NuGet.config
- task: VSBuild@1
displayName: Build solution
@@ -115,6 +111,8 @@ steps:
displayName: Restore nuget packages
inputs:
restoreSolution: $(Build.SourcesDirectory)\pkg\VSSetup\VSSetup.signproj
+ feedsToUse: config
+ nugetConfigPath: $(Build.SourcesDirectory)\NuGet.config
- task: VSBuild@1
displayName: Sign packages
diff --git a/src/VSSetup.PowerShell/VSSetup.PowerShell.csproj b/src/VSSetup.PowerShell/VSSetup.PowerShell.csproj
index c248cec..771fe40 100644
--- a/src/VSSetup.PowerShell/VSSetup.PowerShell.csproj
+++ b/src/VSSetup.PowerShell/VSSetup.PowerShell.csproj
@@ -36,6 +36,14 @@
PreserveNewest
+
+ %(Filename)%(Extension)
+ PreserveNewest
+
+
+ %(Filename)%(Extension)
+ PreserveNewest
+
diff --git a/src/VSSetup.PowerShell/help/Microsoft.VisualStudio.Setup.PowerShell.dll-Help.xml b/src/VSSetup.PowerShell/help/Microsoft.VisualStudio.Setup.PowerShell.dll-Help.xml
new file mode 100644
index 0000000..b0016e0
--- /dev/null
+++ b/src/VSSetup.PowerShell/help/Microsoft.VisualStudio.Setup.PowerShell.dll-Help.xml
@@ -0,0 +1,379 @@
+
+
+
+
+ Get-VSSetupInstance
+ Get
+ VSSetupInstance
+
+ Enumerates instances of Visual Studio and related products.
+
+
+
+ Enumerates instances of Visual Studio and related products. By default, instances with fatal errors are not returned by you can pass `-All` to enumerate them as well.
+
+
+
+ Get-VSSetupInstance
+
+ All
+
+ Enumerate all instances of Visual Studio - even those with fatal errors.
+
+
+ SwitchParameter
+
+
+ False
+
+
+ Prerelease
+
+ Also show prereleases / previews. By default, only releases are shown.
+
+
+ SwitchParameter
+
+
+ False
+
+
+
+ Get-VSSetupInstance
+
+ LiteralPath
+
+ The path to the product installation directory. Wildcards are not supported.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+
+ Get-VSSetupInstance
+
+ Path
+
+ The path to the product installation directory. Wildcards are supported.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+
+
+
+ All
+
+ Enumerate all instances of Visual Studio - even those with fatal errors.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ LiteralPath
+
+ The path to the product installation directory. Wildcards are not supported.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+ Path
+
+ The path to the product installation directory. Wildcards are supported.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+ Prerelease
+
+ Also show prereleases / previews. By default, only releases are shown.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+
+
+
+ System.String[]
+
+
+ One or more paths to product installation directories.
+
+
+
+
+
+
+ Microsoft.VisualStudio.Setup.Instance
+
+
+ Information about each instance enumerated.
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Get-VSSetupInstance -All
+
+ Enumerates all instances of Visual Studio and related products even if a fatal error was raised during the last operation.
+
+
+
+ -------------------------- Example 2 --------------------------
+ PS C:\> Get-VSSetupInstance 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community'
+
+ Gets the instance for the product installed to the given directory.
+
+
+
+
+
+ Online Version:
+ https://github.com/Microsoft/vssetup.powershell/raw/master/docs/VSSetup/Get-VSSetupInstance.md
+
+
+
+
+
+ Select-VSSetupInstance
+ Select
+ VSSetupInstance
+
+ Selects instances of Visual Studio and related products based on criteria.
+
+
+
+ You can specify zero or more products (by default, Visual Studio Community, Professional, and Enterprise are selected) to find, along with zero or more workloads that all are required by any instances enumerated. Additionally, you can specify a version range to limit the results or request the latest instance. All criteria are combined to return the best instance or instances for your needs.
+
+
+
+ Select-VSSetupInstance
+
+ Instance
+
+ One or more instances from which to select.
+
+ Instance[]
+
+ Instance[]
+
+
+ None
+
+
+ Latest
+
+ Select the most recently installed instance with the highest version (within the optional `-Version` range).
+
+
+ SwitchParameter
+
+
+ False
+
+
+ Product
+
+ One or more products to select. Wildcards are supported.
+
+ String[]
+
+ String[]
+
+
+ Microsoft.VisualStudio.Product.Community, Microsoft.VisualStudio.Product.Professional, Microsoft.VisualStudio.Product.Enterprise
+
+
+ Require
+
+ One or more workloads or components to select. All requirements specified must be met. Wildcards are not supported.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+ RequireAny
+
+ Change the behavior of -Require such that any one or more requirements specified must be met.
+
+
+ SwitchParameter
+
+
+ False
+
+
+ Version
+
+ A version range to limit results. A single version like '15.0' is equivalent to '[15.0,)', which means versions 15.0 and newer are in range. You can also specify versions like '[15.0,16.0)' to limit results to Visual Studio 2017 only (15.x).
+
+ String
+
+ String
+
+
+ None
+
+
+
+
+
+ Instance
+
+ One or more instances from which to select.
+
+ Instance[]
+
+ Instance[]
+
+
+ None
+
+
+ Latest
+
+ Select the most recently installed instance with the highest version (within the optional `-Version` range).
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ Product
+
+ One or more products to select. Wildcards are supported.
+
+ String[]
+
+ String[]
+
+
+ Microsoft.VisualStudio.Product.Community, Microsoft.VisualStudio.Product.Professional, Microsoft.VisualStudio.Product.Enterprise
+
+
+ Require
+
+ One or more workloads or components to select. All requirements specified must be met. Wildcards are not supported.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+ RequireAny
+
+ Change the behavior of -Require such that any one or more requirements specified must be met.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ Version
+
+ A version range to limit results. A single version like '15.0' is equivalent to '[15.0,)', which means versions 15.0 and newer are in range. You can also specify versions like '[15.0,16.0)' to limit results to Visual Studio 2017 only (15.x).
+
+ String
+
+ String
+
+
+ None
+
+
+
+
+
+ Microsoft.VisualStudio.Setup.Instance[]
+
+
+ One or more instances from which to select.
+
+
+
+
+
+
+ Microsoft.VisualStudio.Setup.Instance
+
+
+ Zero or more instances that met specified criteria.
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Get-VSSetupInstance | Select-VSSetupInstance -Latest
+
+ Select the most-recently installed instance of the highest version of Visual Studio Community, Professional, or Enterprise installed.
+
+
+
+ -------------------------- Example 2 --------------------------
+ PS C:\> Get-VSSetupInstance | Select-VSSetupInstance -Product * -Require 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
+
+ Selects any product with the native Visual C++ compilers installed.
+
+
+
+
+
+ Online Version:
+ https://github.com/Microsoft/vssetup.powershell/raw/master/docs/VSSetup/Select-VSSetupInstance.md
+
+
+
+
\ No newline at end of file
diff --git a/src/VSSetup.PowerShell/help/about_VSSetup.help.txt b/src/VSSetup.PowerShell/help/about_VSSetup.help.txt
new file mode 100644
index 0000000..864b5c2
--- /dev/null
+++ b/src/VSSetup.PowerShell/help/about_VSSetup.help.txt
@@ -0,0 +1,46 @@
+TOPIC
+ about_vssetup
+
+SHORT DESCRIPTION
+ Enumerate and select instances of Visual Studio.
+
+LONG DESCRIPTION
+ Visual Studio 2017 introduced a new setup engine capable of installing
+ multiple instances of Visual Studio and other products in the Visual Studio
+ family. This module provides commands to enumerate those instances and
+ select instances that meet your criteria. For example, in a development
+ environment you might have a script that finds an instance of Visual Studio
+ with the the Managed Desktop workload for writing projects targeting the
+ .NET Framework. See below for more examples.
+
+VARIABLES
+ You can get the version of this module or of the query API the module uses
+ from the `$VSSetupVersionTable` variable.
+
+ PS> $VSSetupVersionTable
+
+ Name Value
+ ---- -----
+ QueryVersion 1.15.23.19330
+ ModuleVersion 2.1.2.4917
+
+EXAMPLES
+ You can enumerate all instances - even those with errors that require a
+ repair - with the following command.
+
+ Get-VSSetupInstance -All
+
+ If you want to select all launchable instances of Visual Studio products
+ that have the Managed Desktop workload, use the following command.
+
+ Get-VSSetupInstance | Get-VSSetupInstance `
+ -Require 'Microsoft.VisualStudio.Workload.ManagedDesktop'
+
+ You can also get the instance for an installation directory if you want to
+ discover more about what is installed to that directory.
+
+ Get-VSSetupInstance 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community'
+
+SEE ALSO
+ https://github.com/Microsoft/vssetup.powershell
+