private static IEnumerable<AssemblyBinding> AddBindingRedirects( Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IDictionary<string, HashSet<string>> projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting) { var redirects = Enumerable.Empty<AssemblyBinding>(); // Create a project system IFileSystem fileSystem = VsProjectSystemFactory.CreateProjectSystem(project, fileSystemProvider); // Run this on the UI thread since it enumerates all references IEnumerable<string> assemblies = ThreadHelper.Generic.Invoke(() => project.GetAssemblyClosure(fileSystemProvider, projectAssembliesCache)); redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain); if (frameworkMultiTargeting != null) { // filter out assemblies that already exist in the target framework (CodePlex issue #3072) FrameworkName targetFrameworkName = project.GetTargetFrameworkName(); redirects = redirects.Where(p => !FrameworkAssemblyResolver.IsHigherAssemblyVersionInFramework(p.Name, p.AssemblyNewVersion, targetFrameworkName, fileSystemProvider)); } // Create a binding redirect manager over the configuration var manager = new BindingRedirectManager(fileSystem, project.GetConfigurationFile()); // Add the redirects manager.AddBindingRedirects(redirects); return redirects; }
public static async Task AddBindingRedirectsAsync( VSSolutionManager vsSolutionManager, IVsProjectAdapter vsProjectAdapter, IVsFrameworkMultiTargeting frameworkMultiTargeting, INuGetProjectContext nuGetProjectContext) { // Create a new app domain so we can load the assemblies without locking them in this app domain var domain = AppDomain.CreateDomain("assembliesDomain"); try { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // Keep track of visited projects if (await SupportsBindingRedirectsAsync(vsProjectAdapter.Project)) { // Get the dependentEnvDTEProjectsDictionary once here, so that, it is not called for every single project var dependentProjectsDictionary = await vsSolutionManager.GetDependentProjectsDictionaryAsync(); await AddBindingRedirectsAsync(vsSolutionManager, vsProjectAdapter, domain, frameworkMultiTargeting, dependentProjectsDictionary, nuGetProjectContext); } } finally { QueueUnloadAndForget(domain); } }
private static IEnumerable <AssemblyBinding> AddBindingRedirects( Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IDictionary <string, HashSet <string> > projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting) { var redirects = Enumerable.Empty <AssemblyBinding>(); // Create a project system IFileSystem fileSystem = VsProjectSystemFactory.CreateProjectSystem(project, fileSystemProvider); // Run this on the UI thread since it enumerates all references IEnumerable <string> assemblies = ThreadHelper.Generic.Invoke(() => project.GetAssemblyClosure(fileSystemProvider, projectAssembliesCache)); redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain); if (frameworkMultiTargeting != null) { // filter out assemblies that already exist in the target framework (CodePlex issue #3072) FrameworkName targetFrameworkName = project.GetTargetFrameworkName(); redirects = redirects.Where(p => !FrameworkAssemblyResolver.IsHigherAssemblyVersionInFramework(p.Name, p.AssemblyNewVersion, targetFrameworkName, fileSystemProvider)); } // Create a binding redirect manager over the configuration var manager = new BindingRedirectManager(fileSystem, project.GetConfigurationFile()); // Add the redirects manager.AddBindingRedirects(redirects); return(redirects); }
public static void AddBindingRedirects( VSSolutionManager vsSolutionManager, EnvDTEProject envDTEProject, IVsFrameworkMultiTargeting frameworkMultiTargeting, INuGetProjectContext nuGetProjectContext) { // Create a new app domain so we can load the assemblies without locking them in this app domain AppDomain domain = AppDomain.CreateDomain("assembliesDomain"); try { // Keep track of visited projects if (EnvDTEProjectUtility.SupportsBindingRedirects(envDTEProject)) { // Get the dependentEnvDTEProjectsDictionary once here, so that, it is not called for every single project var dependentEnvDTEProjectsDictionary = vsSolutionManager.GetDependentEnvDTEProjectsDictionary(); AddBindingRedirects(vsSolutionManager, envDTEProject, domain, frameworkMultiTargeting, dependentEnvDTEProjectsDictionary, nuGetProjectContext); } } finally { AppDomain.Unload(domain); } }
public AddBindingRedirectCommand( IFileSystemProvider fileSystemProvider, IVsFrameworkMultiTargeting frameworkMultiTargeting) : this() { _fileSystemProvider = fileSystemProvider; _frameworkMultiTargeting = frameworkMultiTargeting; }
public AddBindingRedirectCommand( IFileSystemProvider fileSystemProvider, IVsFrameworkMultiTargeting frameworkMultiTargeting) : this() { _fileSystemProvider = fileSystemProvider; _frameworkMultiTargeting = frameworkMultiTargeting; }
private void InitForBindingRedirects() { if (!BindingRedirectsRelatedInitialized) { var solutionManager = ServiceLocator.GetInstanceSafe <ISolutionManager>(); VSSolutionManager = (solutionManager != null) ? (solutionManager as VSSolutionManager) : null; VSFrameworkMultiTargeting = ServiceLocator.GetGlobalService <SVsFrameworkMultiTargeting, IVsFrameworkMultiTargeting>(); } }
public AddBindingRedirectCommand( ISolutionManager solutionManager, IHttpClientEvents httpClientEvents, IFileSystemProvider fileSystemProvider, IVsFrameworkMultiTargeting frameworkMultiTargeting) : base(solutionManager, null, httpClientEvents) { _solutionManager = solutionManager; _fileSystemProvider = fileSystemProvider; _frameworkMultiTargeting = frameworkMultiTargeting; }
public VsPackageManagerFactory(ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IVsFrameworkMultiTargeting frameworkMultiTargeting, IMachineWideSettings machineWideSettings) { if (solutionManager == null) { throw new ArgumentNullException("solutionManager"); } if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (fileSystemProvider == null) { throw new ArgumentNullException("fileSystemProvider"); } if (repositorySettings == null) { throw new ArgumentNullException("repositorySettings"); } if (packageEvents == null) { throw new ArgumentNullException("packageEvents"); } if (activePackageSourceRepository == null) { throw new ArgumentNullException("activePackageSourceRepository"); } _fileSystemProvider = fileSystemProvider; _repositorySettings = repositorySettings; _solutionManager = solutionManager; _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; _packageEvents = packageEvents; _activePackageSourceRepository = activePackageSourceRepository; _frameworkMultiTargeting = frameworkMultiTargeting; _machineWideSettings = machineWideSettings; _solutionManager.SolutionClosing += (sender, e) => { _repositoryInfo = null; }; }
public VsPackageManagerFactory(ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IVsFrameworkMultiTargeting frameworkMultiTargeting, IMachineWideSettings machineWideSettings) { if (solutionManager == null) { throw new ArgumentNullException("solutionManager"); } if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (fileSystemProvider == null) { throw new ArgumentNullException("fileSystemProvider"); } if (repositorySettings == null) { throw new ArgumentNullException("repositorySettings"); } if (packageEvents == null) { throw new ArgumentNullException("packageEvents"); } if (activePackageSourceRepository == null) { throw new ArgumentNullException("activePackageSourceRepository"); } _fileSystemProvider = fileSystemProvider; _repositorySettings = repositorySettings; _solutionManager = solutionManager; _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; _packageEvents = packageEvents; _activePackageSourceRepository = activePackageSourceRepository; _frameworkMultiTargeting = frameworkMultiTargeting; _machineWideSettings = machineWideSettings; _solutionManager.SolutionClosing += (sender, e) => { _repositoryInfo = null; }; }
public AddBindingRedirectCommand( ISolutionManager solutionManager, IHttpClientEvents httpClientEvents, IFileSystemProvider fileSystemProvider, IVsFrameworkMultiTargeting frameworkMultiTargeting) : base(solutionManager, null, httpClientEvents) { _solutionManager = solutionManager; _fileSystemProvider = fileSystemProvider; _frameworkMultiTargeting = frameworkMultiTargeting; }
public Migrator(DTE applicationObject, IVsFrameworkMultiTargeting frameworkMultiTargeting) { this.applicationObject = applicationObject; this.frameworkMultiTargeting = frameworkMultiTargeting; frameworkMultiTargeting.GetSupportedFrameworks(out Array prgSupportedFrameworks); this.frameworkModels = prgSupportedFrameworks.Cast <string>() .Select(this.GetFrameworkModel) .ToList(); }
private static void AddBindingRedirects( ISolutionManager solutionManager, Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting) { var visitedProjects = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var projectAssembliesCache = new Dictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase); AddBindingRedirects(solutionManager, project, fileSystemProvider, domain, visitedProjects, projectAssembliesCache, frameworkMultiTargeting); }
public TestVsPackageManagerFactory( ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IVsFrameworkMultiTargeting frameworkMultiTargeting, IMachineWideSettings machineWideSettings) : base(solutionManager, repositoryFactory, packageSourceProvider, fileSystemProvider, repositorySettings, packageEvents, activePackageSourceRepository, frameworkMultiTargeting, machineWideSettings) { }
private static void AddBindingRedirects( VSSolutionManager vsSolutionManager, EnvDTEProject envDTEProject, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting, IDictionary <string, List <EnvDTEProject> > dependentEnvDTEProjectsDictionary, INuGetProjectContext nuGetProjectContext) { var visitedProjects = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var projectAssembliesCache = new Dictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase); AddBindingRedirects(vsSolutionManager, envDTEProject, domain, visitedProjects, projectAssembliesCache, frameworkMultiTargeting, dependentEnvDTEProjectsDictionary, nuGetProjectContext); }
private static Task AddBindingRedirectsAsync( VSSolutionManager vsSolutionManager, IVsProjectAdapter vsProjectAdapter, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting, IDictionary <string, List <IVsProjectAdapter> > dependentEnvDTEProjectsDictionary, INuGetProjectContext nuGetProjectContext) { // Need to be on the UI thread var visitedProjects = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var projectAssembliesCache = new Dictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase); return(AddBindingRedirectsAsync(vsSolutionManager, vsProjectAdapter, domain, visitedProjects, projectAssembliesCache, frameworkMultiTargeting, dependentEnvDTEProjectsDictionary, nuGetProjectContext)); }
public static IEnumerable<AssemblyBinding> AddBindingRedirects( Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting) { if (project.SupportsBindingRedirects()) { return AddBindingRedirects( project, fileSystemProvider, domain, new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase), frameworkMultiTargeting); } return Enumerable.Empty<AssemblyBinding>(); }
public static IEnumerable <AssemblyBinding> AddBindingRedirects( Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting) { if (project.SupportsBindingRedirects()) { return(AddBindingRedirects( project, fileSystemProvider, domain, new Dictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase), frameworkMultiTargeting)); } return(Enumerable.Empty <AssemblyBinding>()); }
public VsPackageManager(ISolutionManager solutionManager, IPackageRepository sourceRepository, IFileSystemProvider fileSystemProvider, IFileSystem fileSystem, ISharedPackageRepository sharedRepository, IDeleteOnRestartManager deleteOnRestartManager, VsPackageInstallerEvents packageEvents, IVsFrameworkMultiTargeting frameworkMultiTargeting = null) : base(sourceRepository, new DefaultPackagePathResolver(fileSystem), fileSystem, sharedRepository) { _solutionManager = solutionManager; _sharedRepository = sharedRepository; _packageEvents = packageEvents; _fileSystemProvider = fileSystemProvider; _deleteOnRestartManager = deleteOnRestartManager; _frameworkMultiTargeting = frameworkMultiTargeting; _projects = new Dictionary<string, IProjectManager>(StringComparer.OrdinalIgnoreCase); }
private static async Task AddBindingRedirectsAsync(VSSolutionManager vsSolutionManager, IVsProjectAdapter vsProjectAdapter, AppDomain domain, HashSet <string> visitedProjects, Dictionary <string, HashSet <string> > projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting, IDictionary <string, List <IVsProjectAdapter> > dependentEnvDTEProjectsDictionary, INuGetProjectContext nuGetProjectContext) { Assumes.Present(vsProjectAdapter); // Need to be on the UI thread ThreadHelper.ThrowIfNotOnUIThread(); var envDTEProjectUniqueName = vsProjectAdapter.UniqueName; if (visitedProjects.Contains(envDTEProjectUniqueName)) { return; } if (await SupportsBindingRedirectsAsync(vsProjectAdapter.Project)) { await AddBindingRedirectsAsync(vsSolutionManager, vsProjectAdapter, domain, projectAssembliesCache, frameworkMultiTargeting, nuGetProjectContext); } // Add binding redirects to all envdteprojects that are referencing this one foreach (var dependentEnvDTEProject in GetDependentProjects(dependentEnvDTEProjectsDictionary, vsProjectAdapter)) { await AddBindingRedirectsAsync( vsSolutionManager, dependentEnvDTEProject, domain, visitedProjects, projectAssembliesCache, frameworkMultiTargeting, dependentEnvDTEProjectsDictionary, nuGetProjectContext); } visitedProjects.Add(envDTEProjectUniqueName); }
public static async Task <IEnumerable <AssemblyBinding> > AddBindingRedirectsAsync( ISolutionManager solutionManager, EnvDTEProject envDTEProject, AppDomain domain, IDictionary <string, HashSet <string> > projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting, INuGetProjectContext nuGetProjectContext) { // Run this on the UI thread since it enumerates all references await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var redirects = Enumerable.Empty <AssemblyBinding>(); var msBuildNuGetProjectSystem = GetMSBuildNuGetProjectSystem(solutionManager, envDTEProject); // If no msBuildNuGetProjectSystem, no binding redirects. Bail if (msBuildNuGetProjectSystem == null) { return(redirects); } // Get the full path from envDTEProject var root = EnvDTEProjectUtility.GetFullPath(envDTEProject); IEnumerable <string> assemblies = EnvDTEProjectUtility.GetAssemblyClosure(envDTEProject, projectAssembliesCache); redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain); if (frameworkMultiTargeting != null) { // filter out assemblies that already exist in the target framework (CodePlex issue #3072) FrameworkName targetFrameworkName = EnvDTEProjectUtility.GetDotNetFrameworkName(envDTEProject); redirects = redirects.Where(p => !FrameworkAssemblyResolver.IsHigherAssemblyVersionInFramework(p.Name, p.AssemblyNewVersion, targetFrameworkName)); } // Create a binding redirect manager over the configuration var manager = new BindingRedirectManager(EnvDTEProjectUtility.GetConfigurationFile(envDTEProject), msBuildNuGetProjectSystem); // Add the redirects manager.AddBindingRedirects(redirects); return(redirects); }
public static IEnumerable<AssemblyBinding> AddBindingRedirects( Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting) { if (project.SupportsBindingRedirects()) { // When we're adding binding redirects explicitly, don't check the project type return AddBindingRedirects( project, fileSystemProvider, domain, new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase), frameworkMultiTargeting, checkProjectType: false); } return Enumerable.Empty<AssemblyBinding>(); }
public static async Task <IEnumerable <AssemblyBinding> > AddBindingRedirectsAsync( ISolutionManager solutionManager, IVsProjectAdapter vsProjectAdapter, AppDomain domain, IDictionary <string, HashSet <string> > projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting, INuGetProjectContext nuGetProjectContext) { // Run this on the UI thread since it enumerates all references await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var redirects = Enumerable.Empty <AssemblyBinding>(); var msBuildNuGetProjectSystem = await GetMSBuildNuGetProjectSystemAsync(solutionManager, vsProjectAdapter); // If no msBuildNuGetProjectSystem, no binding redirects. Bail if (msBuildNuGetProjectSystem == null) { return(redirects); } IEnumerable <string> assemblies = await EnvDTEProjectUtility.GetAssemblyClosureAsync(vsProjectAdapter.Project, projectAssembliesCache); redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain); if (frameworkMultiTargeting != null) { var targetFrameworkName = await vsProjectAdapter.GetDotNetFrameworkNameAsync(); redirects = redirects.Where(p => !FrameworkAssemblyResolver.IsHigherAssemblyVersionInFramework(p.Name, p.AssemblyNewVersion, targetFrameworkName)); } // Create a binding redirect manager over the configuration var manager = new BindingRedirectManager(await vsProjectAdapter.Project.GetConfigurationFileAsync(), msBuildNuGetProjectSystem); // Add the redirects manager.AddBindingRedirects(redirects); return(redirects); }
public static void AddBindingRedirects( ISolutionManager solutionManager, Project project, IFileSystemProvider fileSystemProvider, IVsFrameworkMultiTargeting frameworkMultiTargeting) { // Create a new app domain so we can load the assemblies without locking them in this app domain AppDomain domain = AppDomain.CreateDomain("assembliesDomain"); try { // Keep track of visited projects if (project.SupportsBindingRedirects()) { AddBindingRedirects(solutionManager, project, fileSystemProvider, domain, frameworkMultiTargeting); } } finally { AppDomain.Unload(domain); } }
public static void AddBindingRedirects( ISolutionManager solutionManager, Project project, IFileSystemProvider fileSystemProvider, IVsFrameworkMultiTargeting frameworkMultiTargeting) { // Create a new app domain so we can load the assemblies without locking them in this app domain AppDomain domain = AppDomain.CreateDomain("assembliesDomain"); try { // Keep track of visited projects if (project.SupportsBindingRedirects()) { AddBindingRedirects(solutionManager, project, fileSystemProvider, domain, frameworkMultiTargeting); } } finally { AppDomain.Unload(domain); } }
private static async Task AddBindingRedirectsAsync(VSSolutionManager vsSolutionManager, EnvDTEProject envDTEProject, AppDomain domain, HashSet <string> visitedProjects, Dictionary <string, HashSet <string> > projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting, IDictionary <string, List <EnvDTEProject> > dependentEnvDTEProjectsDictionary, INuGetProjectContext nuGetProjectContext) { // Need to be on the UI thread string envDTEProjectUniqueName = EnvDTEProjectUtility.GetUniqueName(envDTEProject); if (visitedProjects.Contains(envDTEProjectUniqueName)) { return; } if (EnvDTEProjectUtility.SupportsBindingRedirects(envDTEProject)) { await AddBindingRedirectsAsync(vsSolutionManager, envDTEProject, domain, projectAssembliesCache, frameworkMultiTargeting, nuGetProjectContext); } // Add binding redirects to all envdteprojects that are referencing this one foreach (EnvDTEProject dependentEnvDTEProject in VSSolutionManager.GetDependentEnvDTEProjects(dependentEnvDTEProjectsDictionary, envDTEProject)) { await AddBindingRedirectsAsync( vsSolutionManager, dependentEnvDTEProject, domain, visitedProjects, projectAssembliesCache, frameworkMultiTargeting, dependentEnvDTEProjectsDictionary, nuGetProjectContext); } visitedProjects.Add(envDTEProjectUniqueName); }
private static IEnumerable<AssemblyBinding> AddBindingRedirects( Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IDictionary<string, HashSet<string>> projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting, bool checkProjectType = true) { var redirects = Enumerable.Empty<AssemblyBinding>(); // Only add binding redirects to projects that aren't class libraries if (!checkProjectType || project.SupportsConfig()) { // Create a project system IFileSystem fileSystem = VsProjectSystemFactory.CreateProjectSystem(project, fileSystemProvider); // Run this on the UI thread since it enumerates all references IEnumerable<string> assemblies = ThreadHelper.Generic.Invoke(() => project.GetAssemblyClosure(fileSystemProvider, projectAssembliesCache)); redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain); if (frameworkMultiTargeting != null) { // filter out assemblies that already exist in the target framework (CodePlex issue #3072) string targetFramework = project.GetTargetFramework(); redirects = redirects.Where(p => !IsAssemblyAvaialbleInFramework(p.Name, targetFramework, frameworkMultiTargeting)); } // Create a binding redirect manager over the configuration var manager = new BindingRedirectManager(fileSystem, project.GetConfigurationFile()); // Add the redirects manager.AddBindingRedirects(redirects); } return redirects; }
private static void AddBindingRedirects( ISolutionManager solutionManager, Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, HashSet <string> projects, IDictionary <string, HashSet <string> > projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting) { string projectUniqueName = project.GetUniqueName(); if (projects.Contains(projectUniqueName)) { return; } if (project.SupportsBindingRedirects()) { AddBindingRedirects(project, fileSystemProvider, domain, projectAssembliesCache, frameworkMultiTargeting); } // Add binding redirects to all projects that are referencing this one foreach (Project dependentProject in solutionManager.GetDependentProjects(project)) { AddBindingRedirects( solutionManager, dependentProject, fileSystemProvider, domain, projects, projectAssembliesCache, frameworkMultiTargeting); } projects.Add(projectUniqueName); }
// Copied from SLPackage.Package.GetInstalledSLFrameworks in Microsoft.VisualStudio.Silverlight.dll private static List <string> GetInstalledSLFrameworks(IServiceProvider serviceProvider) { List <string> list = new List <string>(); IVsFrameworkMultiTargeting service = GetService <IVsFrameworkMultiTargeting, SVsFrameworkMultiTargeting>(serviceProvider); if (service != null) { Array array; service.GetSupportedFrameworks(out array); // array content samples: // ".NETFramework,Version=v2.0" // ".NETFramework,Version=v3.0" // ".NETFramework,Version=v3.5" // ".NETFramework,Version=v3.5,Profile=Client" // ".NETFramework,Version=v4.0" // ".NETFramework,Version=v4.0,Profile=Client" // "Silverlight,Version=v4.0" // "Silverlight,Version=v4.0,Profile=WindowsPhone71" // "Silverlight,Version=v5.0" foreach (string str in array) { FrameworkName name = new FrameworkName(str); if ((String.Compare(name.Identifier, "Silverlight", StringComparison.OrdinalIgnoreCase) == 0 && name.Version.Major > 2) && String.IsNullOrEmpty(name.Profile)) { string version = String.Format(CultureInfo.InvariantCulture, "v{0}.{1}", name.Version.Major, name.Version.Minor); if (!String.IsNullOrEmpty(GetSilverlightRuntimeSDKInstallLocation(version))) { list.Add(version); } } } } list.Sort(); return(list); }
private static bool IsAssemblyAvaialbleInFramework(string assembly, string targetFramework, IVsFrameworkMultiTargeting frameworkMultiTargeting) { bool result; int succeeded = frameworkMultiTargeting.IsReferenceableInTargetFx(assembly, targetFramework, out result); return ErrorHandler.Succeeded(succeeded) && result; }
private static void AddBindingRedirects( ISolutionManager solutionManager, Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, HashSet<string> projects, IDictionary<string, HashSet<string>> projectAssembliesCache, IVsFrameworkMultiTargeting frameworkMultiTargeting) { string projectUniqueName = project.GetUniqueName(); if (projects.Contains(projectUniqueName)) { return; } if (project.SupportsBindingRedirects()) { AddBindingRedirects(project, fileSystemProvider, domain, projectAssembliesCache, frameworkMultiTargeting); } // Add binding redirects to all projects that are referencing this one foreach (Project dependentProject in solutionManager.GetDependentProjects(project)) { AddBindingRedirects( solutionManager, dependentProject, fileSystemProvider, domain, projects, projectAssembliesCache, frameworkMultiTargeting); } projects.Add(projectUniqueName); }
public AddBindingRedirectCommand() { _frameworkMultiTargeting = ServiceLocator.GetGlobalService <SVsFrameworkMultiTargeting, IVsFrameworkMultiTargeting>(); }
public TestVsPackageManagerFactory( ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IVsFrameworkMultiTargeting frameworkMultiTargeting, IMachineWideSettings machineWideSettings) : base(solutionManager, repositoryFactory, packageSourceProvider, fileSystemProvider, repositorySettings, packageEvents, activePackageSourceRepository, frameworkMultiTargeting, machineWideSettings) { }
private static void AddBindingRedirects( ISolutionManager solutionManager, Project project, IFileSystemProvider fileSystemProvider, AppDomain domain, IVsFrameworkMultiTargeting frameworkMultiTargeting) { var visitedProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase); var projectAssembliesCache = new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase); AddBindingRedirects(solutionManager, project, fileSystemProvider, domain, visitedProjects, projectAssembliesCache, frameworkMultiTargeting); }
public AddBindingRedirectCommand() : base() { _frameworkMultiTargeting = ServiceLocator.GetGlobalService<SVsFrameworkMultiTargeting, IVsFrameworkMultiTargeting>(); }