public async Task <BlazorPackage> Locate(string name) { using (var operation = Log.OnEnterAndExit()) { var dotnet = new Dotnet(_packagesDirectory); var toolNames = await dotnet.ToolList(_packagesDirectory); if (toolNames.Contains(name)) { operation.Info($"Checking tool {name}"); var result = await CommandLine.Execute(Path.Combine(_packagesDirectory.FullName, name), "locate-projects"); var directory = new DirectoryInfo(result.Output.First()); if (directory.Exists) { var runnerSubDirectory = directory.GetDirectories("runner-*").FirstOrDefault(); if (runnerSubDirectory?.Exists ?? false) { var path = Path.Combine(runnerSubDirectory.FullName, "MLS.Blazor"); var package = new BlazorPackage(runnerSubDirectory.Name, null, new DirectoryInfo(path)); if (package.BlazorEntryPointAssemblyPath.Exists) { return(package); } } } } } return(null); }
public static Task <CommandLineResult> ToolInstall( this Dotnet dotnet, string packageName, DirectoryInfo toolPath, PackageSource addSource = null, Budget budget = null, string version = null) { var versionArg = version != null ? $"--version {version}" : ""; var args = $@"{packageName} --tool-path ""{toolPath.FullName.RemoveTrailingSlash()}"" {versionArg}"; if (addSource != null) { args += $@" --add-source ""{addSource}"""; } return(dotnet.Execute("tool install".AppendArgs(args), budget)); }
public async Task <WebAssemblyAsset> Locate(string name) { using (var operation = Log.OnEnterAndExit()) { var dotnet = new Dotnet(_packagesDirectory); var toolNames = await dotnet.ToolList(_packagesDirectory); if (toolNames.Contains(name)) { operation.Info($"Checking tool {name}"); var tool = new PackageTool(name, _packagesDirectory); await tool.Prepare(); return(await tool.LocateWasmAsset()); } } return(null); }
public static Task <CommandLineResult> ToolInstall( this Dotnet dotnet, string packageName, DirectoryInfo toolPath, PackageSource addSource = null, Budget budget = null, string version = null) { if (string.IsNullOrWhiteSpace(packageName)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(packageName)); } var versionArg = version != null ? $"--version {version}" : ""; var args = $@"{packageName} --tool-path ""{toolPath.FullName.RemoveTrailingSlash()}"" {versionArg}"; if (addSource != null) { args += $@" --add-source ""{addSource}"""; } return(dotnet.Execute("tool install".AppendArgs(args), budget)); }