protected override void Execute(CommandContext context) { context.Logger.Output("*=installed"); context.Logger.Output(""); var channel = new StableAssetChannel(); var stable = channel.GetLatest(SdkAsset.CreateAssetId(Architecture.X64)).Version; foreach (var sdk in channel.GetAll(SdkAsset.CreateAssetId(Architecture.X64))) { var version = sdk.Version; var line = version == stable ? $"{version} ({SdkAsset.DefaultVersion})" : version; var installed = context.Environment .Sdks .Any(s => s.Version.Equals(version)) ? "*" : " "; context.Logger.Output($" {installed} {line}"); } context.Result = Result.Okay; }
public void ListsRuntimeAssetsAsDependencies() { var asset = new SdkAsset(NullLogger.Instance, TestDotNetEnv.Create(), "1.0.1", Architecture.X64); asset.Dependencies .Should() .AllBeOfType <RuntimeAsset>() .And.HaveCount(2); asset.Dependencies .Cast <RuntimeAsset>() .Select(r => r.Version) .Should() .Contain(new[] { "1.0.4", "1.1.1" }); }