Skip to content

Commit 1ad7e60

Browse files
authored
Merge pull request #37 from advanced-security/Update-Nuget-Guidance
Update compiled-languages-csharp.md
2 parents 8908857 + b4189a9 commit 1ad7e60

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

troubleshooting/codeql-builds/compiled-languages-csharp.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,24 @@ Alternatively, consider adding auth for your GitHub Packages hosted NuGet feed u
7676
### .NET Framework
7777
7878
#### NuGet Authentication
79-
Utilize the [nuget/setup-nuget](https://github.com/nuget/setup-nuget#basic) action to pass package key/source to nuget exe.
79+
Since you are unable to use the [nuget/setup-nuget](https://github.com/nuget/setup-nuget#basic) action to pass package key/source to nuget exe for restore, instead fallback to the nuget sources commands.
80+
81+
You can update an existing source (by name - these might exist in a `nuget.config`) to include credentials via the `nuget sources Update` command
8082

8183
```yml
82-
- uses: nuget/setup-nuget@v1
83-
with:
84-
nuget-api-key: ${{ secrets.NuGetAPIKey }}
84+
- name: NuGet Restore
85+
run: |
86+
nuget sources Update -Name "SourceName" -UserName "any" -Password "${{ secrets.NUGET_PACKAGES_PAT }}"
87+
nuget restore
88+
```
89+
90+
Alternatively, add a new source with `nuget sources Add`
91+
92+
```yml
93+
- name: NuGet Restore
94+
run: |
95+
nuget sources Add -Name "SourceName" -Source "https://url.to.your/source" -UserName "any" -Password "${{ secrets.NUGET_PACKAGES_PAT }}"
96+
nuget restore
8597
```
8698

8799
#### Manual Build Steps on Windows Runners

0 commit comments

Comments
 (0)