本文整理汇总了C#中SolutionFolder.GetAllItems方法的典型用法代码示例。如果您正苦于以下问题:C# SolutionFolder.GetAllItems方法的具体用法?C# SolutionFolder.GetAllItems怎么用?C# SolutionFolder.GetAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolutionFolder
的用法示例。
在下文中一共展示了SolutionFolder.GetAllItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveProjectReferences
public static void ResolveProjectReferences (SolutionFolder folder, IProgressMonitor monitor)
{
Dictionary<string, DotNetProject> projects = new Dictionary<string, DotNetProject> ();
foreach (DotNetProject p in folder.GetAllItems<DotNetProject> ()) {
string filename = p.GetOutputFileName (ConfigurationSelector.Default);
// Can be null for Generic projects
if (!String.IsNullOrEmpty (filename))
projects [filename] = p;
}
foreach (DotNetProject sproj in projects.Values) {
MakefileData mdata = sproj.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (mdata == null)
continue;
if (mdata.UnresolvedReferences.Count != 0) {
Dictionary<string, ProjectReference> asmProjectRefs =
new Dictionary<string, ProjectReference> ();
foreach (ProjectReference pr in sproj.References) {
if (pr.ReferenceType != ReferenceType.Assembly &&
pr.ReferenceType != ReferenceType.Project)
continue;
string [] files = pr.GetReferencedFileNames (ConfigurationSelector.Default);
if (files.Length > 0)
asmProjectRefs [files [0]] = pr;
}
List<string> toRemove = new List<string> ();
foreach (string refstr in mdata.UnresolvedReferences.Keys) {
if (asmProjectRefs.ContainsKey (refstr)) {
// ref already exists in the project
toRemove.Add (refstr);
asmProjectRefs.Remove (refstr);
} else {
// Try as a project ref
if (projects.ContainsKey (refstr)) {
sproj.References.Add (new ProjectReference (projects [refstr]));
toRemove.Add (refstr);
}
}
}
foreach (string s in toRemove)
mdata.UnresolvedReferences.Remove (s);
// Add all remaining unresolved refs as Assembly refs
foreach (string s in mdata.UnresolvedReferences.Keys)
sproj.References.Add (new ProjectReference (ReferenceType.Assembly, s));
// Remove asm/project refs not found in UnresolvedReferences
foreach (ProjectReference pr in asmProjectRefs.Values)
sproj.References.Remove (pr);
mdata.UnresolvedReferences.Clear ();
}
mdata.UpdateMakefile (monitor);
}
}