Step 1 -> Create or edit the nuget.config file in your solution directory:
There are 2 methods to configure NuGet packages
Method 1 - Using CLI Command: Navigate to your project directory in the terminal and run the command dotnet add package [LibraryName] to add the desired library.
You need to configure your GitHub credentials to access the package feed. Add the following to your `nuget.config` file:
Step 3 ->
Replace:
- `YOUR_GITHUB_USERNAME` with your GitHub username
- `YOUR_GITHUB_PAT` with a GitHub Personal Access Token that has `read:packages` scope
Important: You must create a GitHub Personal Access Token with both `repo` and `packages` permissions. Without these specific permissions, package installation will fail. To create a token:
Go to GitHub Settings > Developer Settings > Personal Access Tokens
Generate a new token with at least `repo` and `packages` scopes
Copy the token immediately as it won't be shown again
Note: Never commit your GitHub credentials to source control. Consider using environment variables or user-specific configuration files.
Step 4 -> Install Required Packages
If you configured the package source manually, you need to install the required packages using the following commands: