I am writing a CSharpAnalyzerTest
. The test method is failing because it wants to connect to a private repository that is defined on machine-level as a nuget source. It obviously fails, and throws an exception from RunAsync()
with the message: NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source…..
On project-level I have a custom nuget.config
that resets this to the basics:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="public" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
I have tried to add a nuget.config
to TestState.AdditionalFiles
, but it is not taken into consideration.
How can I override the nuget settings within the testing environment? How can I ‘inject’ a nuget.config
or otherwise take control over how nuget works inside?
[Update]
I have found ReferenceAssemblies.WithNuGetConfigFilePath
, although it is not a nice one, as it expects an outside path, not an inside one 🙁