private static async Task <HashSet <string> > GetWebsiteLocalAssembliesAsync(EnvDTE.Project envDTEProject) { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var assemblies = new HashSet <string>(PathComparer.Default); var references = GetAssemblyReferences(envDTEProject); foreach (AssemblyReference reference in references) { // For websites only include bin assemblies if (reference.ReferencedProject == null && reference.ReferenceKind == AssemblyReferenceType.AssemblyReferenceBin && File.Exists(reference.FullPath)) { assemblies.Add(reference.FullPath); } } // For website projects, we always add .refresh files that point to the corresponding binaries in packages. In the event of bin deployed assemblies that are also GACed, // the ReferenceKind is not AssemblyReferenceBin. Consequently, we work around this by looking for any additional assembly declarations specified via .refresh files. var envDTEProjectPath = await envDTEProject.GetFullPathAsync(); CollectionsUtility.AddRange(assemblies, RefreshFileUtility.ResolveRefreshPaths(envDTEProjectPath)); return(assemblies); }
internal static HashSet <string> GetAssemblyClosure(EnvDTE.Project envDTEProject, IDictionary <string, HashSet <string> > visitedProjects) { ThreadHelper.ThrowIfNotOnUIThread(); HashSet <string> assemblies; if (visitedProjects.TryGetValue(envDTEProject.UniqueName, out assemblies)) { return(assemblies); } assemblies = new HashSet <string>(PathComparer.Default); visitedProjects.Add(envDTEProject.UniqueName, assemblies); var localProjectAssemblies = GetLocalProjectAssemblies(envDTEProject); CollectionsUtility.AddRange(assemblies, localProjectAssemblies); var referencedProjects = GetReferencedProjects(envDTEProject); foreach (var project in referencedProjects) { var assemblyClosure = GetAssemblyClosure(project, visitedProjects); CollectionsUtility.AddRange(assemblies, assemblyClosure); } return(assemblies); }
internal static async Task <HashSet <string> > GetAssemblyClosureAsync(EnvDTE.Project envDTEProject, IDictionary <string, HashSet <string> > visitedProjects) { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); HashSet <string> assemblies; if (visitedProjects.TryGetValue(envDTEProject.UniqueName, out assemblies)) { return(assemblies); } assemblies = new HashSet <string>(PathComparer.Default); visitedProjects.Add(envDTEProject.UniqueName, assemblies); var localProjectAssemblies = await GetLocalProjectAssembliesAsync(envDTEProject); CollectionsUtility.AddRange(assemblies, localProjectAssemblies); var referencedProjects = GetReferencedProjects(envDTEProject); foreach (var project in referencedProjects) { var assemblyClosure = await GetAssemblyClosureAsync(project, visitedProjects); CollectionsUtility.AddRange(assemblies, assemblyClosure); } return(assemblies); }
internal static HashSet <string> GetAssemblyClosure(EnvDTEProject envDTEProject, IDictionary <string, HashSet <string> > visitedProjects) { HashSet <string> assemblies; if (visitedProjects.TryGetValue(envDTEProject.UniqueName, out assemblies)) { return(assemblies); } assemblies = new HashSet <string>(PathComparer.Default); CollectionsUtility.AddRange(assemblies, GetLocalProjectAssemblies(envDTEProject)); CollectionsUtility.AddRange(assemblies, GetReferencedProjects(envDTEProject).SelectMany(p => GetAssemblyClosure(p, visitedProjects))); visitedProjects.Add(envDTEProject.UniqueName, assemblies); return(assemblies); }