public ICompilation ResolveAssemblyDom(string assemblyName) { var parsed = SystemAssemblyService.ParseAssemblyName(assemblyName); if (string.IsNullOrEmpty(parsed.Name)) { return(null); } var dllName = parsed.Name + ".dll"; foreach (var reference in References) { if (reference.ReferenceType == ReferenceType.Package || reference.ReferenceType == ReferenceType.Assembly) { foreach (string refPath in reference.GetReferencedFileNames(null)) { if (Path.GetFileName(refPath) == dllName) { return(new ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation(TypeSystemService.LoadAssemblyContext(TargetRuntime, TargetFramework, refPath))); } } } else if (reference.ReferenceType == ReferenceType.Project && parsed.Name == reference.Reference) { var p = ParentSolution.FindProjectByName(reference.Reference) as DotNetProject; if (p == null) { LoggingService.LogWarning("Project '{0}' referenced from '{1}' could not be found", reference.Reference, this.Name); continue; } return(TypeSystemService.GetCompilation(p)); } } string path = GetAssemblyPath(assemblyName); if (path != null) { return(new ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation(TypeSystemService.LoadAssemblyContext(TargetRuntime, TargetFramework, path))); } return(null); }
public ProjectDom ResolveAssemblyDom(string assemblyName) { var parsed = SystemAssemblyService.ParseAssemblyName(assemblyName); if (string.IsNullOrEmpty(parsed.Name)) { return(null); } var dllName = parsed.Name + ".dll"; foreach (var reference in References) { if (reference.ReferenceType == ReferenceType.Package || reference.ReferenceType == ReferenceType.Assembly) { foreach (string refPath in reference.GetReferencedFileNames(null)) { if (Path.GetFileName(refPath) == dllName) { return(ProjectDomService.GetAssemblyDom(TargetRuntime, refPath)); } } } else if (reference.ReferenceType == ReferenceType.Project && parsed.Name == reference.Reference) { var p = ParentSolution.FindProjectByName(reference.Reference) as DotNetProject; if (p == null) { LoggingService.LogWarning("Project '{0}' referenced from '{1}' could not be found", reference.Reference, this.Name); continue; } return(ProjectDomService.GetProjectDom(p)); } } string path = GetAssemblyPath(assemblyName); if (path != null) { return(ProjectDomService.GetAssemblyDom(TargetRuntime, path)); } return(null); }
public override IEnumerable <SolutionItem> GetReferencedItems(ConfigurationSelector configuration) { List <SolutionItem> items = new List <SolutionItem> (); if (ParentSolution == null) { return(items); } foreach (ProjectReference pref in References) { if (pref.ReferenceType == ReferenceType.Project) { Project rp = ParentSolution.FindProjectByName(pref.Reference); if (rp != null) { items.Add(rp); } } } return(items); }
protected override IEnumerable <SolutionItem> OnGetReferencedItems(ConfigurationSelector configuration) { foreach (var p in base.GetReferencedItems(configuration)) { yield return(p); } if (ParentSolution == null) { yield break; } foreach (Package p in Packages) { if (p.IsProject && p.Name != Name) { var cp = ParentSolution.FindProjectByName(p.Name) as CProject; if (cp != null) { yield return(cp); } } } }
void PopulateSupportFileList(FileCopySet list, ConfigurationSelector configuration, int referenceDistance) { if (referenceDistance < 2) { base.PopulateSupportFileList(list, configuration); } //rename the app.config file FileCopySet.Item appConfig = list.Remove("app.config"); if (appConfig == null) { appConfig = list.Remove("App.config"); } if (appConfig != null) { string output = Path.GetFileName(GetOutputFileName(configuration)); list.Add(appConfig.Src, appConfig.CopyOnlyIfNewer, output + ".config"); } //collect all the "local copy" references and their attendant files foreach (ProjectReference projectReference in References) { if (!projectReference.LocalCopy || ParentSolution == null) { continue; } if (projectReference.ReferenceType == ReferenceType.Project) { DotNetProject p = ParentSolution.FindProjectByName(projectReference.Reference) as DotNetProject; if (p == null) { LoggingService.LogWarning("Project '{0}' referenced from '{1}' could not be found", projectReference.Reference, this.Name); continue; } string refOutput = p.GetOutputFileName(configuration); if (string.IsNullOrEmpty(refOutput)) { LoggingService.LogWarning("Project '{0}' referenced from '{1}' has an empty output filename", p.Name, this.Name); continue; } list.Add(refOutput); //VS COMPAT: recursively copy references's "local copy" files //but only copy the "copy to output" files from the immediate references p.PopulateSupportFileList(list, configuration, referenceDistance + 1); DotNetProjectConfiguration refConfig = p.GetConfiguration(configuration) as DotNetProjectConfiguration; if (refConfig != null && refConfig.DebugMode) { string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile(refOutput); if (File.Exists(mdbFile)) { list.Add(mdbFile); } } } else if (projectReference.ReferenceType == ReferenceType.Assembly) { // VS COMPAT: Copy the assembly, but also all other assemblies referenced by it // that are located in the same folder foreach (string file in GetAssemblyRefsRec(projectReference.Reference, new HashSet <string> ())) { list.Add(file); if (File.Exists(file + ".config")) { list.Add(file + ".config"); } string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile(file); if (File.Exists(mdbFile)) { list.Add(mdbFile); } } } else if (projectReference.ReferenceType == ReferenceType.Custom) { foreach (string refFile in projectReference.GetReferencedFileNames(configuration)) { list.Add(refFile); } } } }