To create a NuGet credential provider in C#, you can follow these steps:
ICredentialProvider
interface from NuGet.Core:main.cs774 chars17 lines
NuGet.Core
package as a dependency in your package.NuGet.config
file:419 chars17 lines
Replace {SERVER_NAME}
with the name of the server for which you want to use the custom credential provider, {USERNAME}
and {PASSWORD}
with the user credentials to authenticate for that server, and MyCredentialProvider
with the full name of your custom credential provider class (including the namespace).
Now, when you run a command that requires authentication for the specified server, NuGet will invoke your custom credential provider and use the obtained credentials to authenticate.
gistlibby LogSnag