5

We use the lprun feature of LINQPAD to run our build scripts; However as we are in a corporate environment we block access to the NuGet.org package source:

<add key="nuget.org" value="https://www.nuget.org/api/v2/" />

And instead use a corporate proxy e.g. a custom package source:

<add key="MyProxy" value="https://proxy.server/custom-nuget-repo" />

When developing locally these sources are specified in:

C:\Users\Me\AppData\Roaming\Nuget.config

However LINQPAD is ignoring this file, how can I provide custom package sources when using the lprun to restore NuGet packages referenced?

Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
MaYaN
  • 6,683
  • 12
  • 57
  • 109

2 Answers2

3

lprun and LINQPad both use the file %AppData%\LINQPad\NuGetSources.xml for NuGet Package sources, so this is the file you need to edit.

In case this file doesn't exist, here is an example:

<?xml version="1.0" encoding="utf-8"?>
<NuGetSources>
  <Source Name="(default)" />
  <Source Name="My Packages" URI="https://www.myget.org/F/your-username-here/" UserName="Example" Password="base64encodedstring" Enabled="false" />
</NuGetSources>
Keith Hall
  • 15,362
  • 3
  • 53
  • 71
3

From newer LinqPad versions this is built in to the LinqPad NuGet manager. Go to QueryProperties (F4) -> 'Add Nuget' -> 'Settings' and new package sources can be added just as easily as in VS.

Adding a new answer here since Google led me to this question first when trying to find the answer.

Niclas
  • 1,220
  • 6
  • 12