Exemple #1
0
        public void InstallPackage(string packageId, string projectPath, string targetFolder)
        {
            var packagePathResolver      = new DefaultPackagePathResolver(targetFolder);
            var packagesFolderFileSystem = new PhysicalFileSystem(targetFolder);
            var projectSystem            = new BetterThanMSBuildProjectSystem(projectPath)
            {
                Logger = _console
            };
            var localRepository = new BetterThanLocalPackageRepository(packagePathResolver, packagesFolderFileSystem, projectSystem);
            var projectManager  = new ProjectManager(_packageRepository, packagePathResolver, projectSystem,
                                                     localRepository)
            {
                Logger = _console
            };

            projectManager.PackageReferenceAdded += (sender, args) => args.Package.GetLibFiles()
                                                    .Each(file => SaveAssemblyFile(args.InstallPath, file));
            projectManager.AddPackageReference(packageId);
            projectSystem.Save();
        }
        public void InstallPackage(string packageId, string projectPath, string targetFolder)
        {
            var packagePathResolver = new DefaultPackagePathResolver(targetFolder);
            var packagesFolderFileSystem = new PhysicalFileSystem(targetFolder);
            var projectSystem = new BetterThanMSBuildProjectSystem(projectPath) { Logger = _console };
            var localRepository = new BetterThanLocalPackageRepository(packagePathResolver, packagesFolderFileSystem, projectSystem);
            var projectManager = new ProjectManager(_packageRepository, packagePathResolver, projectSystem,
                                                    localRepository) {Logger = _console};

            projectManager.PackageReferenceAdded += (sender, args) => args.Package.GetLibFiles()
                                                                          .Each(file => SaveAssemblyFile(args.InstallPath, file));
            projectManager.AddPackageReference(packageId);
            projectSystem.Save();
        }