本文整理汇总了C#中IRuntimeEnvironment.GetDefaultRestoreRuntimes方法的典型用法代码示例。如果您正苦于以下问题:C# IRuntimeEnvironment.GetDefaultRestoreRuntimes方法的具体用法?C# IRuntimeEnvironment.GetDefaultRestoreRuntimes怎么用?C# IRuntimeEnvironment.GetDefaultRestoreRuntimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRuntimeEnvironment
的用法示例。
在下文中一共展示了IRuntimeEnvironment.GetDefaultRestoreRuntimes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public static void Register(CommandLineApplication cmdApp, ReportsFactory reportsFactory, IApplicationEnvironment applicationEnvironment, IRuntimeEnvironment runtimeEnvironment)
{
cmdApp.Command("restore", c =>
{
c.Description = "Restore packages";
var argRoot = c.Argument("[root]",
"List of projects and project folders to restore. Each value can be: a path to a project.json or global.json file, or a folder to recursively search for project.json files.",
multipleValues: true);
var feedCommandLineOptions = FeedCommandLineOptions.Add(c);
var optLock = c.Option("--lock",
"Creates dependencies file with locked property set to true. Overwrites file if it exists.",
CommandOptionType.NoValue);
var optUnlock = c.Option("--unlock",
"Creates dependencies file with locked property set to false. Overwrites file if it exists.",
CommandOptionType.NoValue);
var optRuntimes = c.Option("--runtime <RID>",
"List of runtime identifiers to restore for",
CommandOptionType.MultipleValue);
c.HelpOption("-?|-h|--help");
c.OnExecute(async () =>
{
c.ShowRootCommandFullNameAndVersion();
var feedOptions = feedCommandLineOptions.GetOptions();
var command = new RestoreCommand(applicationEnvironment);
command.Reports = reportsFactory.CreateReports(feedOptions.Quiet);
command.RestoreDirectories.AddRange(argRoot.Values);
command.FeedOptions = feedOptions;
command.Lock = optLock.HasValue();
command.Unlock = optUnlock.HasValue();
command.RequestedRuntimes = optRuntimes.Values;
command.FallbackRuntimes = runtimeEnvironment.GetDefaultRestoreRuntimes();
if (!string.IsNullOrEmpty(feedOptions.Proxy))
{
Environment.SetEnvironmentVariable("http_proxy", feedOptions.Proxy);
}
var success = await command.Execute();
return success ? 0 : 1;
});
});
}