Пример #1
0
            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);
            }