Skip to content

Instantly share code, notes, and snippets.

@alistairjevans
Last active April 17, 2020 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alistairjevans/344db3fc54e011b3211334bfc30f4d6c to your computer and use it in GitHub Desktop.
Save alistairjevans/344db3fc54e011b3211334bfc30f4d6c to your computer and use it in GitHub Desktop.
/// <summary>
/// Represents the configuration for a single extension to install.
/// </summary>
public class ExtensionConfiguration
{
public string Package { get; set; }
public string Version { get; set; }
public bool PreRelease { get; set; }
}
public static void Main(string[] args)
{
// Define a source provider, with my own feed.
var sourceProvider = new PackageSourceProvider(NullSettings.Instance, new []
{
new PackageSource("https://f.feedz.io/autostep/ci/nuget/index.json")
});
// Establish the source repository provider; the available providers come from our custom settings.
var sourceRepositoryProvider = new SourceRepositoryProvider(sourceProvider, Repository.Provider.GetCoreV3());
// Get the list of repositories.
var repositories = sourceRepositoryProvider.GetRepositories();
// Disposable source cache.
using var sourceCacheContext = new SourceCacheContext();
// You should use an actual logger here, this is a NuGet ILogger instance.
var logger = new NullLogger();
// My extension configuration:
var extensions = new[] { new ExtensionConfiguration
{
Package = "AutoStep.Web",
PreRelease = true // Allow pre-release versions.
}};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment