Skip to content

Commit 50acc16

Browse files
Merge pull request #10322 from MicrosoftDocs/main638575526900700006sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents eefa330 + cbedee2 commit 50acc16

17 files changed

+442
-33
lines changed

docs/debugger/autos-and-locals-windows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Inspect variables - Autos and Locals windows
33
description: Inspect variables in the Autos and Locals windows while debugging in Visual Studio. The Autos and Locals windows show variable values while you are debugging.
4-
ms.date: 07/20/2023
4+
ms.date: 07/25/2024
55
ms.topic: how-to
66
f1_keywords:
77
- vs.debug.autos
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
---
2+
title: Sign CLI reference for VSIX packages
3+
description: The Sign CLI command can sign VSIX packages using certificates from PFX, Windows Certificate Manager (WCM), or Cryptographic Service Providers (CSP).
4+
ms.topic: reference
5+
helpviewer_keywords:
6+
- signature
7+
- signing
8+
- sign
9+
- pfx
10+
- sha256
11+
- authenticode
12+
- vsix
13+
- packages
14+
- dotnet
15+
author: javierdlg
16+
ms.author: maiak
17+
manager: mijacobs
18+
ms.subservice: extensibility-integration
19+
ms.date: 04/11/2024
20+
---
21+
22+
# Sign CLI Reference for VSIX Packages
23+
24+
`sign` - Dotnet tool used to sign files and containers using PFX, CER, or P7B certificates on disk or from Windows Certificate Manager (WCM), Cryptographic Service Providers (CSP), or Azure Key Vault.
25+
26+
> [!IMPORTANT]
27+
> Sign CLI only supports `SHA-256`, `SHA-384`, and `SHA-512` as valid fingerprint algorithms. You can use PowerShell to get fingerprints using: `Get-FileHash -Algorithm SHA256 <path to .cer file> | Format-Table -AutoSize`
28+
29+
## Synopsis
30+
31+
```dotnetcli
32+
sign code certificate-store [<PATH(s)>]
33+
[-cf|--certificate-file <PATH>]
34+
[-p|--password <PASSWORD>]
35+
[-cfp|--certificate-fingerprint <SHA>]
36+
[-csp|--crypto-service-provider <CSPNAME>]
37+
[-k|--key-container <HASHALGORITHM>]
38+
[-km|--use-machine-key-container]
39+
[-d|--description <DESCRIPTION>]
40+
[-u|--descriptionUrl <URL>]
41+
[-fd|--file-digest <DIGEST>]
42+
[-t|--timestamp-url <URL>]
43+
[-tr|--timestamp-rfc3161 <URL>]
44+
[-td|--timestamp-digest <DIGEST>]
45+
[-o|--output <PATH>]
46+
[-b|--base-directory <wORKINGDIRECTORY>]
47+
[-f|--force]
48+
[-m|--max-concurrency <MAXCONCURRENCY>]
49+
[-fl|--filelist <FILELISTPATH>]
50+
51+
sign code certificate-store -h|--help
52+
```
53+
54+
## Description
55+
56+
`Sign CLI` is a Dotnet tool that recursively signs files and containers with a certificate and private. The certificate and private key can be obtained from either a file (PFX, P7B, CER) or from a certificate installed in a certificate store by providing a `SHA-256`, `SHA-384`, or `SHA-512` fingerprint. USB keys can be accessed using a [Cryptographic Service Provider](/windows/win32/seccrypto/cryptographic-service-providers) (CSP) implemented by the manufacturer and accessed from the certificate store.
57+
58+
## Installation
59+
Install Sign CLI globally using `dotnet tool install sign --version <version> --global`, where `<version>` is the latest available version under [Sign (nuget.org)](https://www.nuget.org/packages/sign).
60+
61+
### Offline Installation of Sign CLI
62+
For isolated environments you can download a Sign CLI NuGet package and install it using:
63+
64+
```dotnetcli
65+
dotnet tool install --global --add-source <path-to-folder> <tool-name> --version <version>
66+
```
67+
68+
## Arguments
69+
70+
- **`VSIX-paths(s)`**
71+
72+
Specifies the path(s) to the VSIX package to be signed.
73+
74+
## Options
75+
76+
- **`-cf|--certificate-file <PATH>`**
77+
78+
PFX, P7B, or CER file containing a certificate and potentially a private key.
79+
80+
- **`-p|--password <PASSWORD>`**
81+
82+
Optional password for certificate file.
83+
84+
- **`-cfp|--certificate-fingerprint <SHA>`**
85+
86+
SHA-256, SHA-384, or SHA-512 fingerprint used to identify a certificate before signing.
87+
88+
- **`-csp|--crypto-service-provider <CSP NAME>`**
89+
90+
Cryptographic Service Provider containing a private key.
91+
92+
- **`-k|--key-container <CONTAINER NAME>]`**
93+
94+
Private key container name.
95+
96+
- **`-km|--use-machine-key-container]`**
97+
98+
Use a machine-level private key container instead of the default user-level container.
99+
100+
- **`-d|--description <DESCRIPTION>`**
101+
102+
Description of the signing certificate.
103+
104+
- **`-u|--descriptionUrl <URL>`**
105+
106+
Description Url of the signing certificate.
107+
108+
- **`-fd | --file-digest <DIGEST>`**
109+
110+
Digest algorithm to hash the file with.
111+
112+
- **`-t|--timestamp-url <URL>`**
113+
114+
RFC 3161 timestamp server URL. [default: http://timestamp.acs.microsoft.com/]
115+
116+
- **`-tr | --timestamp-rfc3161 <URL>`**
117+
118+
Specifies the RFC 3161 timestamp server's URL.
119+
120+
- **`-td|--timestamp-digest <DIGEST>`**
121+
122+
Used with `-tr` switch to request a digest algorithm used by the RFC 3161 timestamp server.
123+
124+
- **`-o|--output <PATH>`**
125+
126+
The output file or folder if multiple files are specified. If omitted, input is overwritten.
127+
128+
- **`-b|--base-directory <PATH>`**
129+
130+
Base directory for files to override the working directory.
131+
132+
- **`--f|--force`**
133+
134+
Overwrites a signature if it exists.
135+
136+
- **`-m|--max-concurrency <MAXCONCURRENCY>`**
137+
138+
Maximum concurrency (default is 4)
139+
140+
- **`-fl | --filelist <PATH>`**
141+
142+
Path to file containing paths of files to sign or to exclude from signing within the container.
143+
144+
- **`-?|-h|--help`**
145+
146+
Prints a description of how to use the command.
147+
148+
## Examples
149+
150+
- Sign *contoso.vsix* with a certificate imported to the **user** certificate store:
151+
152+
```dotnetcli
153+
sign contoso.vsix -cfp 24D589...FB9523B36E -d "Constoso VSIX Signature" -u "http://www.contoso.com"
154+
```
155+
156+
- Sign *contoso.vsix* with certificate *cert.pfx* (not password protected) using a SHA-512 fingerprint:
157+
158+
```dotnetcli
159+
sign contoso.vsix -cfp A87A6F...894559B981 -cfpa sha512 -cf D:\certificates\cert.pfx -d "Constoso VSIX Signature" -u "http://www.contoso.com"
160+
```
161+
162+
- Sign *contoso.vsix* with certificate *cert.pfx* (password protected):
163+
164+
```dotnetcli
165+
sign contoso.vsix -s 24D58920B2D24D00A7DF07FB9523B36E -cf cert.pfx -p <password> -d "Constoso VSIX Signature" -u "http://www.contoso.com"
166+
```
167+
168+
- Sign multiple VSIX packages - *contoso.vsix* and *all .vsix files in the directory specified* with certificate *cert.pfx* (not password protected):
169+
170+
```dotnetcli
171+
sign *.vsix -s 24D58920B2D24D00A7DF07FB9523B36E -cf cert.pfx -d "Constoso VSIX Signature" -u "http://www.contoso.com"
172+
```
173+
174+
- Sign *contoso.vsix* with a certificate stored in a secure USB drive.
175+
176+
```dotnetcli
177+
sign contoso.vsix -s 24D58920B2D24D00A7DF07FB9523B36E -csp "Microsoft Software Key Storage Provider" -k "NuGetSigning 0B2D249223B36D00A7DF07FB95E24D58" -d "Constoso VSIX Signature" -u "http://www.contoso.com"
178+
```
179+
180+
- Sign *contoso.vsix* with a certificate stored in a secure USB drive and accessed from the **machine** certificate store (-km option).
181+
182+
```dotnetcli
183+
sign contoso.vsix -s 24D58920B2D24D00A7DF07FB9523B36E -csp "Microsoft Software Key Storage Provider" -k "NuGetSigning 0B2D249223B36D00A7DF07FB95E24D58" -km -d "Constoso VSIX Signature" -u "http://www.contoso.com"
184+
```
185+
186+
> [!NOTE]
187+
> When `-k` option isn't provided, the tool checks all containers in the provided CSP for a matching SHA fingerprint certificate.
188+
189+
- Sign *contoso.vsix* with a certificate stored in a secure USB drive specifying file digest algorithm (-fd), timestamp server (-t), and a custom output path (-o) for the signed VSIX.
190+
191+
```dotnetcli
192+
sign contoso.vsix -s 24D58920B2D24D00A7DF07FB9523B36E -csp "Microsoft Software Key Storage Provider" -k "NuGetSigning 0B2D249223B36D00A7DF07FB95E24D58" -d "Constoso VSIX Signature" -u "http://www.contoso.com" -t "http://timestamp.acs.microsoft.com/" -fd sha256 -o "ContosoSigned.vsix"
193+
```
Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,103 @@
11
---
2-
title: Signing VSIX Packages
2+
title: Signing VSIX packages
33
description: Learn about signing extension assemblies. The VSIX installer displays a message that a VSIX is signed and information about the signature itself.
4-
ms.date: 11/04/2016
4+
ms.date: 4/10/2024
55
ms.topic: how-to
66
helpviewer_keywords:
77
- signature
88
- signing
99
- authenticode
1010
- vsix
1111
- packages
12-
author: maiak
12+
author: javierdlg
1313
ms.author: maiak
1414
manager: mijacobs
1515
ms.subservice: extensibility-integration
1616
---
17+
1718
# Signing VSIX Packages
19+
Extension assemblies don't need to be signed before they can run in Visual Studio, but it's a good practice to do so.
20+
21+
Adding a digital signature to a VSIX package secures your extension and prevents tampering. During install, the VSIX installer displays the signature and a link to the certificate. If the contents of the VSIX are modified without updating the signature, the installer only warns the user of an invalid package signature. This guide assumes you have already [created a VSIX](../extensibility/getting-started-with-the-vsix-project-template.md).
22+
23+
## Get a code signing certificate
24+
25+
Valid certificates can be obtained from a public certificate authority such as:
26+
27+
- [Certum](https://www.certum.eu/certum/cert,offer_en_open_source_cs.xml)
28+
- [Comodo](https://www.comodo.com/e-commerce/code-signing/code-signing-certificate.php)
29+
- [DigiCert](https://www.digicert.com/code-signing/)
30+
- [GlobalSign](https://www.globalsign.com/en/code-signing-certificate/)
31+
- [SSL.com](https://www.ssl.com/certificates/code-signing/)
32+
33+
The complete list of certification authorities trusted by Windows can also be obtained from [http://aka.ms/trustcertpartners](/security/trusted-root/participants-list).
34+
35+
You can use self-issued certificates for testing purposes. However, VSIX packages signed using self-issued certificates are not accepted by Visual Studio Marketplace. Learn more about [generating self-signed certificates with the .NET CLI](/dotnet/core/additional-tools/self-signed-certificates-guide).
36+
37+
## Signing a VSIX with Sign CLI
38+
VSIXSignTool has been deprecated in favor of [Sign CLI (github.com)](https://github.com/dotnet/sign). This tool is published to NuGet as a dotnet tool under [Sign (nuget.org)](https://www.nuget.org/packages/sign) and supports local signing or using Azure Key Vault cloud signing.
1839

19-
Extension assemblies do not need to be signed before they can run in Visual Studio, but it is a good practice to do so.
40+
For local signing, Sign CLI supports certificates and private keys stored in any combination of these locations:
41+
- `PFX`, `P7B`, or `CER` files
42+
- Imported into Windows Certificate Manager
43+
- Stored in a USB device with access via a [Cryptographic Service Provider](/windows/win32/seccrypto/cryptographic-service-providers) (CSP)
2044

21-
If you want to secure your extension and make sure it hasn't been tampered with, you can add a digital signature to a VSIX package. When a VSIX is signed, the VSIX installer will display a message indicating that it is signed, plus more information about the signature itself. If the contents of the VSIX have been modified, and the VSIX has not been signed again, the VSIX installer will show that the signature is not valid. The installation is not stopped, but the user is warned.
45+
### Installing Sign CLI
46+
1. Open a [Developer PowerShell](/visualstudio/ide/reference/command-prompt-powershell) instance.
47+
48+
1. Verify nuget.org is added and enabled as a NuGet source.
49+
- Check your sources using `dotnet nuget list source`
50+
- Add NuGet.org as a source using `dotnet nuget add source -n NuGet.org https://api.nuget.org/v3/index.json`
51+
52+
1. Install Sign by running `dotnet tool install sign --version <version> --global`, where `<version>` is the latest available version under [Sign (nuget.org)](https://www.nuget.org/packages/sign).
53+
- `--global` is optional and installs the tool in the .NET tools default location that is automatically added to the PATH environment variable.
54+
55+
### Offline Installation of Sign CLI
56+
For isolated environments you can download the latest Sign CLI NuGet package and install it using:
57+
58+
```dotnetcli
59+
dotnet tool install --global --add-source <path-to-folder> <tool-name> --version <version>
60+
```
61+
62+
For example:
63+
64+
```dotnetcli
65+
dotnet tool install --global --add-source D:\NuGetTools sign --version 99.0
66+
```
67+
68+
### Using Sign CLI
69+
Once installed, Sign CLI can be accessed in a Developer PowerShell instance using `sign code <command> <options>`. For a breakdown of the options see [Sign CLI Reference for VSIX Packages](../extensibility/dotnet-sign-CLI-reference-vsix.md).
2270

2371
> [!IMPORTANT]
24-
> Beginning with Visual Studio 2015, VSIX packages signed using anything other than SHA256 encryption will be identified as having an invalid signature. VSIX installation is not blocked but the user will be warned.
72+
> Sign CLI only supports `SHA-256`, `SHA-384`, and `SHA-512` as valid fingerprint algorithms. You can use PowerShell to get fingerprints using: `Get-FileHash -Algorithm SHA256 <path to .cer file> | Format-Table -AutoSize`
73+
74+
- Signing using a PFX file with a SHA-256 fingerprint:
2575

26-
## Signing a VSIX with VSIXSignTool
27-
There is a SHA256 encryption signing tool available from [VisualStudioExtensibility](https://www.nuget.org/profiles/VisualStudioExtensibility) on nuget.org at [VsixSignTool](https://www.nuget.org/packages/Microsoft.VSSDK.Vsixsigntool).
76+
```dotnetcli
77+
sign code certificate-store -cfp 80BB567B...52CB95D4C -cf "D:\Certs\f5ec6169345347a7cd2f83af662970d5d0bfc914.pfx" -d "My VSIX Signature" -u "http://timestamp.acs.microsoft.com/" "C:\Users\Contoso\Downloads\FingerSnapper2022.vsix"
78+
```
2879

29-
#### To use the VSIXSignTool
80+
> [!NOTE]
81+
> PFX files contain both certificate and private key used for signing and don't comply with C/A Browser Forum requirements for Extended Validation (EV) and non-EV signing. it's recommended to only use private keys stored in a Hardened Secure Module (HSM) device and access them using a Cryptographic Service Provider (CSP).
3082
31-
1. Add your VSIX to a project.
83+
- Signing using Microsoft Certificate Manager and a SHA512 fingerprint (-csp option):
3284

33-
2. Right click on the project node in Solution Explorer, selecting **Add &#124; Manage NuGet Packages**. For more information on NuGet and adding NuGet packages see the [NuGet documentation](/NuGet) and [Package Manager UI](/NuGet/Tools/Package-Manager-UI) topics.
85+
```dotnetcli
86+
code certificate-store -cfp A87A60A6F...894559B98 -csp "Microsoft Software Key Storage Provider" -d "My VSIX Signature" -u "http://timestamp.acs.microsoft.com/" "C:\Users\Contoso\Downloads\FingerSnapper2022.vsix"
87+
```
3488

35-
3. Search for VSIXSignTool from VisualStudioExtensibility and install the NuGet package.
89+
- Signing using a private key in a USB drive (-csp option):
3690

37-
4. You can now run the VSIXSignTool from the project's local packages location. Consult the tool's command line help for your signing scenario (VSIXSignTool.exe /?).
91+
```dotnetcli
92+
code certificate-store -cfp B113E82D...F5CF294BE0B -csp "eToken Base Cryptographic Provider" -d "VSIX Signature" -u "http://timestamp.acs.microsoft.com/" "C:\Users\Contoso\Downloads\FingerSnapper2022.vsix"
93+
```
3894

39-
For example to sign with a password protected certificate file:
95+
- Signing using a USB drive using a specific key container (-csp and -k options):
4096

41-
VSIXSignTool.exe sign /f \<certfile> /p \<password> \<VSIXfile>
97+
```dotnetcli
98+
code certificate-store -s 15BB56B0...1ACB959D0 -csp "eToken Base Cryptographic Provider" -k "NuGet Signing.629c9149345347cd2f83af6f5ec70d5d0a7bf616" -d "VSIX Signature" -u "http://timestamp.acs.microsoft.com/" "C:\Users\Contoso\Downloads\FingerSnapper2022.vsix"
99+
```
42100

43101
## Related content
44102
- [Shipping Visual Studio Extensions](../extensibility/shipping-visual-studio-extensions.md)
103+
- [Sign CLI Reference for VSIX Packages](../extensibility/dotnet-sign-CLI-reference-vsix.md)

docs/extensibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@
526526
href: preparing-extensions-for-windows-installer-deployment.md
527527
- name: Sign VSIX Packages
528528
href: signing-vsix-packages.md
529+
- name: Sign CLI Reference
530+
href: dotnet-sign-cli-reference-vsix.md
529531
- name: Private Galleries
530532
items:
531533
- name: Private Galleries

0 commit comments

Comments
 (0)