public NuGetProject(List <string> packagesList, string packagesPath, ProjectFile projectFile, ILog log) { this.log = log; this.packagesList = packagesList; this.projectFile = projectFile; installedPackages = new HashSet <PackageIdentity>(); var sourceProvider = new PackageSourceProvider(Settings.LoadDefaultSettings(null)); var sourceRepositoryProvider = new CommandLineSourceRepositoryProvider(sourceProvider); repositories = sourceProvider.LoadPackageSources().Select(sourceRepositoryProvider.CreateRepository) .ToList(); logger = new Console(); var projectFilePath = projectFile.FilePath; var msbuildDirectory = Path.GetDirectoryName(ModuleBuilderHelper.FindMsBuild(null, "Cement NuGet Package Installer")); projectContext = new ConsoleProjectContext(logger); projectSystem = new MSBuildProjectSystem( msbuildDirectory, projectFilePath, projectContext); var projectFolder = Path.GetDirectoryName(projectFilePath); project = new MSBuildNuGetProject(projectSystem, packagesPath, projectFolder); }
private static string FindTool(Tool buildTool, string moduleName) { if (buildTool.Name != "msbuild") { return(buildTool.Name); } if (Helper.OsIsUnix()) { return("msbuild"); } return(ModuleBuilderHelper.FindMsBuild(buildTool.Version, moduleName)); }
private static MsBuildLikeTool FindTool(Tool buildTool, string moduleName) { if (buildTool.Name != "msbuild") { return(new MsBuildLikeTool(buildTool.Name)); } if (Platform.IsUnix()) { return(new MsBuildLikeTool("msbuild")); } var tool = ModuleBuilderHelper.FindMsBuild(buildTool.Version, moduleName); return(tool); }