You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/consume-packages/managing-the-global-packages-and-cache-folders.md
+22-15Lines changed: 22 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ Whenever you install, update, or restore a package, NuGet manages packages and p
17
17
| global‑packages | The *global-packages* folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference format always use packages directly from this folder. When using the `packages.config`, packages are installed to the *global-packages* folder, then copied into the project's `packages` folder.<br/><ul><li>Windows: `%userprofile%\.nuget\packages`</li><li>Mac/Linux: `~/.nuget/packages`</li><li>Override using the NUGET_PACKAGES environment variable, the `globalPackagesFolder` or `repositoryPath`[configuration settings](../reference/nuget-config-file.md#config-section) (when using PackageReference and `packages.config`, respectively), or the `RestorePackagesPath` MSBuild property (MSBuild only). The environment variable takes precedence over the configuration setting.</li></ul> |
18
18
| http‑cache | The Visual Studio Package Manager (NuGet 3.x+) and the `dotnet` tool store copies of downloaded packages in this cache (saved as `.dat` files), organized into subfolders for each package source. Packages are not expanded, and the cache has an expiration time of 30 minutes.<br/><ul><li>Windows: `%localappdata%\NuGet\v3-cache`</li><li>Mac/Linux: `~/.local/share/NuGet/v3-cache`</li><li>Override using the NUGET_HTTP_CACHE_PATH environment variable.</li></ul> |
19
19
| temp | A folder where NuGet stores temporary files during its various operations.<br/><li>Windows: `%temp%\NuGetScratch`</li><li>Mac/Linux: `/tmp/NuGetScratch`</li></ul> |
20
+
| plugins-cache **4.8+**| A folder where NuGet stores the results from the operation claims request.<br/><ul><li>Windows: `%localappdata%\NuGet\plugins-cache`</li><li>Mac/Linux: `~/.local/share/NuGet/plugins-cache`</li><li>Override using the NUGET_PLUGINS_CACHE_PATH environment variable.</li></ul> |
20
21
21
22
> [!Note]
22
23
> NuGet 3.5 and earlier uses *packages-cache* instead of the *http-cache*, which is located in `%localappdata%\NuGet\Cache`.
@@ -29,38 +30,40 @@ For more information, see [What happens when a package is installed](ways-to-ins
29
30
30
31
## Viewing folder locations
31
32
32
-
You can view folder locations using the [dotnet nuget locals command](/dotnet/core/tools/dotnet-nuget-locals):
33
+
You can view locations using the [nuget locals command](../tools/cli-ref-locals.md):
33
34
34
35
```cli
35
-
dotnet nuget locals all --list
36
+
# Display locals for all folders: global-packages, http cache, temp and plugins cache
37
+
nuget locals all -list
36
38
```
37
39
38
-
Typical output (Mac/Linux; "user1" is the current username):
40
+
Typical output (Windows; "user1" is the current username):
39
41
40
42
```output
41
-
info : http-cache: /home/user1/.local/share/NuGet/v3-cache
42
-
info : global-packages: /home/user1/.nuget/packages/
To directly specify files to include in the package, edit the project file and use the `content` property:
151
+
152
+
```xml
153
+
<ItemGroup>
154
+
<Content Include="readme.txt">
155
+
<Pack>true</Pack>
156
+
<PackagePath>\</PackagePath>
157
+
</Content>
158
+
</ItemGroup>
159
+
```
160
+
161
+
This will include a file named `readme.txt` in the package root. Visual Studio displays the contents of that file as plain text immediately after installing the package directly. (Readme files are not displayed for packages installed as dependencies). For example, here's how the readme for the HtmlAgilityPack package appears:
162
+
163
+

164
+
165
+
> [!Note]
166
+
> Merely adding the readme.txt at the project root will not result in it being included in the resulting package.
167
+
148
168
## Related topics
149
169
150
170
-[Create a Package](../create-packages/creating-a-package.md)
Copy file name to clipboardExpand all lines: docs/reference/extensibility/NuGet-Credential-Providers-for-Visual-Studio.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,13 @@ After you install a NuGet credential provider for Visual Studio, the NuGet Visua
15
15
16
16
A sample implementation can be found in [the VsCredentialProvider sample](https://github.com/NuGet/Samples/tree/master/VsCredentialProvider).
17
17
18
+
Starting with 4.8+ NuGet in Visual Studio supports the new cross platform authentication plugins as well, but they are not the recommended approach for performance reasons.
19
+
18
20
> [!Note]
19
-
> NuGet credential providers for Visual Studio must be installed as a regular Visual Studio extension and will require [Visual Studio 2017](https://aka.ms/vs/15/preview/vs_enterprise) (currently in preview) or above.
21
+
> NuGet credential providers for Visual Studio must be installed as a regular Visual Studio extension and will require [Visual Studio 2017](http://aka.ms/vs/15/release/vs_enterprise.exe) or above.
20
22
>
21
23
> NuGet credential providers for Visual Studio work only in Visual Studio (not in dotnet restore or nuget.exe). For credential providers with nuget.exe, see [nuget.exe Credential Providers](nuget-exe-Credential-providers.md).
24
+
> For credential providers in dotnet and msbuild see [NuGet cross platform plugins](#NuGet-Cross-Platform-Authentication-Plugin.md)
22
25
23
26
## Available NuGet credential providers for Visual Studio
24
27
@@ -38,7 +41,8 @@ During credential acquisition, the credential service will try credential provid
38
41
39
42
1. Credentials will be fetched from NuGet configuration files (using the built-in `SettingsCredentialProvider`).
40
43
1. If the package source is on Visual Studio Team Services, the `VisualStudioAccountProvider` will be used.
41
-
1. All other plug-in credential providers will be tried sequentially.
44
+
1. All other plug-in Visual Studio credential providers will be tried sequentially.
45
+
1. Try to use all NuGet cross platform credential providers sequentially.
42
46
1. If no credentials have been acquired yet, the user will be prompted for credentials using a standard basic authentication dialog.
description: NuGet cross platform authentication plugins for NuGet.exe, dotnet.exe, msbuild.exe and Visual Studio
4
+
author: nkolev92
5
+
ms.author: nikolev
6
+
manager: rrelyea
7
+
ms.date: 07/01/2018
8
+
ms.topic: conceptual
9
+
---
10
+
11
+
# NuGet cross platform authentication plugin
12
+
13
+
In version 4.8+, all NuGet clients (NuGet.exe, Visual Studio, dotnet.exe and MSBuild.exe) can use an authentication plugin built on top of the [NuGet cross platform plugins](NuGet-Cross-Platform-Plugins.md) model.
14
+
15
+
## Available NuGet cross platform authentication plugins
16
+
17
+
TBD - Link to the VSTS provider
18
+
19
+
## Authentication in dotnet.exe
20
+
21
+
Visual Studio and NuGet.exe are by default interactive. NuGet.exe contains a switch to make it [non interactive](../../tools/nuget-exe-CLI-Reference.md).
22
+
Additionally the NuGet.exe and Visual Studio plugins prompt the user for input.
23
+
In dotnet.exe there is no prompting and the default is non interactive.
24
+
25
+
The authentication mechanism in dotnet.exe is device flow. When the restore or add package operation is run interactively, the operation blocks and instructions to the user how to complete the authentications will be provided on the command line.
26
+
When the user completes the authentication the operation will continue.
27
+
28
+
To make the operation interactive, one should pass `--interactive`.
29
+
Currently only the explicit `dotnet restore` and `dotnet add package` commands support an interactive switch.
30
+
There is no interactive switch on `dotnet build` and `dotnet publish`.
31
+
32
+
## Authentication in MSBuild
33
+
34
+
Similar to dotnet.exe, MSBuild.exe is by default non interactive the MSBuild.exe authentication mechanism is device flow.
35
+
To allow the restore to pause and wait for authentication, call restore with `msbuild /t:restore /p:NuGetInteractive="true"`.
36
+
37
+
## Creating a cross platform authentication plugin
38
+
39
+
A sample implementation can be found in [MSCredProvider plugin](https://github.com/Microsoft/mscredprovider).
40
+
41
+
It's very important that the plugins conforms to the security requirements set forth by the NuGet client tools.
42
+
The minimum required version for a plugin to be an authentication plugin is *2.0.0*.
43
+
NuGet will perform the handshake with the plugin and query for the supported operation claims.
44
+
Please refer to the NuGet cross platform plugin [protocol messages](NuGet-Cross-Platform-Plugins.md#protocol-messages-index) for more details about the specific messages.
45
+
46
+
NuGet will set the log level and provide proxy information to the plugin when applicable.
47
+
Logging to the NuGet console is only acceptable after NuGet has set the log level to the plugin.
48
+
49
+
- .NET Framework plugin authentication behavior
50
+
51
+
In .NET Framework, the plugins are allowed to prompt a user for input, in the form of a dialog.
52
+
53
+
- .NET Core plugin authentication behavior
54
+
55
+
In .NET Core, a dialog cannot be shown. The plugins should use device flow to authenticate.
56
+
The plugin can send log messages to NuGet with instructions to the user.
57
+
Note that logging is available after the log level has been set to the plugin.
58
+
NuGet will not take any interactive input from the command line.
59
+
60
+
When the client calls the plugin with a Get Authentication Credentials, the plugins need to conform to the interactivity switch and respect the dialog switch.
61
+
62
+
The following table summarizes how the plugin should behave for all combinations.
| true | true | The IsNonInteractive switch takes precedence over the dialog switch. The plugin is not allowed to pop a dialog. This combination is only valid for .NET Framework plugins |
67
+
| true | false | The IsNonInteractive switch takes precedence over the dialog switch. The plugin is not allowed to block. This combination is only valid for .NET Core plugins |
68
+
| false | true | The plugin should show a dialog. This combination is only valid for .NET Framework plugins |
69
+
| false | false | The plugin should/can not show a dialog. The plugin should use device flow to authenticate by logging an instruction message via the logger. This combination is only valid for .NET Core plugins |
70
+
71
+
Please refer to the following specs before writing a plugin.
0 commit comments