当前位置: 首页>>代码示例>>C#>>正文


C# SolutionFolder.GetAllItems方法代码示例

本文整理汇总了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);
			}
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:62,代码来源:MakefileData.cs


注:本文中的SolutionFolder.GetAllItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。