Ejemplo n.º 1
0
        public VsProject(VsSolution solution, DteProject dteProject, IProjectManager projectManager)
            : base()
        {
            _solution  = solution;
            _installed = new CoreInteropInstalledPackagesList((IPackageReferenceRepository2)projectManager.LocalRepository);
            DteProject = dteProject;

            // Add V2-related interop features
            AddFeature(() => projectManager);
            AddFeature(() => projectManager.PackageManager);
            AddFeature(() => projectManager.Project);
            AddFeature(() => projectManager.PackageManager.LocalRepository);
            AddFeature <IPackageCacheRepository>(() => MachineCache.Default);

            // the source repository of the local repo of the project
            AddFeature <SourceRepository>(() =>
            {
                var repo = new NuGet.Client.Interop.V2SourceRepository(
                    null,
                    projectManager.LocalRepository,
                    "");
                return(repo);
            });

            // Add PowerShell feature
            AddFeature <PowerShellScriptExecutor>(() =>
                                                  new VsPowerShellScriptExecutor(ServiceLocator.GetInstance <IScriptExecutor>()));

#if VS14
            // Add NuGetAwareProject if the project system is nuget-aware.
            _nugetAwareProject = projectManager.Project as INuGetPackageManager;
            if (_nugetAwareProject != null)
            {
                AddFeature <NuGetAwareProject>(() => new VsNuGetAwareProject(_nugetAwareProject));
            }
#endif
        }
Ejemplo n.º 2
0
        public VsProject(VsSolution solution, DteProject dteProject, IProjectManager projectManager)
            : base()
        {
            _solution = solution;
            _installed = new CoreInteropInstalledPackagesList((IPackageReferenceRepository2)projectManager.LocalRepository);
            DteProject = dteProject;

            // Add V2-related interop features
            AddFeature(() => projectManager);
            AddFeature(() => projectManager.PackageManager);
            AddFeature(() => projectManager.Project);
            AddFeature(() => projectManager.PackageManager.LocalRepository);
            AddFeature<IPackageCacheRepository>(() => MachineCache.Default);

            // the source repository of the local repo of the project
            AddFeature<SourceRepository>(() =>
            {
                var repo = new NuGet.Client.Interop.V2SourceRepository(
                    null,
                    projectManager.LocalRepository,
                    "");
                return repo;
            });

            // Add PowerShell feature
            AddFeature<PowerShellScriptExecutor>(() =>
                new VsPowerShellScriptExecutor(ServiceLocator.GetInstance<IScriptExecutor>()));

#if VS14
            // Add NuGetAwareProject if the project system is nuget-aware.
            _nugetAwareProject = projectManager.Project as INuGetPackageManager;
            if (_nugetAwareProject != null)
            {
                AddFeature<NuGetAwareProject>(() => new VsNuGetAwareProject(_nugetAwareProject));
            }
#endif
        }