public override bool Execute() { var logger = new Logger(BuildEngine, MessageImportance.High); var downloadDir = Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode); var resolver = new NuGetExeResolver(logger, SolutionDir, ProjectDir, downloadDir); var path = resolver.GetNuGetExePath(); if (String.IsNullOrEmpty(path)) return false; NuGetExePath = new TaskItem(path); return true; }
protected override string GenerateFullPathToTool() { var nuGetExePath = mNuGetExePathSpecified; if (!String.IsNullOrEmpty(nuGetExePath) && File.Exists(nuGetExePath)) { Logger.LogMessage(MessageImportance, "Using NuGet.exe from '{0}'.", nuGetExePath); mNuGetExePathResolved = nuGetExePath; return nuGetExePath; } nuGetExePath = mNuGetExePathResolved; if (!String.IsNullOrEmpty(nuGetExePath) && File.Exists(nuGetExePath)) return nuGetExePath; var downloadDir = Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode); var resolver = new NuGetExeResolver(Logger, SolutionDir, ProjectDir, downloadDir); nuGetExePath = resolver.GetNuGetExePath(); mNuGetExePathResolved = nuGetExePath; return nuGetExePath ?? Constants.NuGetFileName; }