Example #1
0
        private async Task <IPackage> TryInstallAndLocateTool(PackageDescriptor packageDesciptor)
        {
            var dotnet = new Dotnet();

            var installationResult = await dotnet.ToolInstall(
                packageDesciptor.Name,
                _workingDirectory.GetFullyQualifiedRoot(),
                _addSource?.ToString());

            if (installationResult.ExitCode != 0)
            {
                Logger <LocalToolInstallingPackageDiscoveryStrategy> .Log.Warning($"Tool not installed: {packageDesciptor.Name}");

                return(null);
            }

            var tool = PackageTool.TryCreateFromDirectory(packageDesciptor.Name, _workingDirectory);

            if (tool != null)
            {
                return(await CreatePackage(packageDesciptor, tool));
            }

            return(null);
        }
        private async Task <PackageBuilder> TryInstallAndLocateTool(PackageDescriptor packageDesciptor, Budget budget)
        {
            var dotnet = new Dotnet();

            var installationResult = await dotnet.ToolInstall(
                packageDesciptor.Name,
                _workingDirectory,
                _addSource?.ToString());

            if (installationResult.ExitCode != 0)
            {
                Logger <LocalToolInstallingPackageDiscoveryStrategy> .Log.Warning($"Tool not installed: {packageDesciptor.Name}");

                return(null);
            }

            var tool = await _locator.LocatePackageAsync(packageDesciptor.Name, budget);

            if (tool != null)
            {
                return(CreatePackageBuilder(packageDesciptor, tool));
            }

            return(null);
        }