CCNet.Build.Common.ProjectDocument.GetProjectReferences C# (CSharp) Method

GetProjectReferences() public method

Returns all project references from current project.
public GetProjectReferences ( ) : List
return List
		public List<ProjectReference> GetProjectReferences()
		{
			return SelectElements("/ms:Project/ms:ItemGroup/ms:ProjectReference")
				.Select(e => new ProjectReference(e))
				.ToList();
		}

Usage Example

		private void ConvertProjectReferences(ProjectDocument project)
		{
			if (Path.GetExtension(Args.ProjectFile) == ".sfproj")
				return;

			Console.Write("Resolving project references... ");

			foreach (var reference in project.GetProjectReferences())
			{
				string name = null;
				foreach (var check in Util.LocalNameToProjectNames(reference.Name))
				{
					if (m_log.ContainsKey(check))
					{
						name = check;
						break;
					}
				}

				if (name == null)
				{
					throw new InvalidOperationException(
						$@"Referenced project '{reference.Name}' was not found in 'packages.config'.
Please add it as a NuGet reference first, and only after that you can convert it into project reference.");
				}

				m_log[name].ProjectReference = true;

				var framework = m_checker.TargetFramework(name);
				reference.ConvertToBinary(framework, name);
			}

			Console.WriteLine("OK");
		}
All Usage Examples Of CCNet.Build.Common.ProjectDocument::GetProjectReferences