CCNet.Build.SetupProject.Program.SetupRelatedProjects C# (CSharp) Method

SetupRelatedProjects() private static method

private static SetupRelatedProjects ( ) : void
return void
		private static void SetupRelatedProjects()
		{
			string path;
			switch (Args.ProjectType)
			{
				case ProjectType.CloudService:
					path = Paths.CloudProjectFile;
					break;

				case ProjectType.FabricApplication:
					path = Paths.FabricProjectFile;
					break;

				default:
					return;
			}

			if (String.IsNullOrEmpty(Args.RelatedPath))
				throw new InvalidOperationException("Configuration argument 'RelatedPath' is not set.");

			if (String.IsNullOrEmpty(Args.ReferencesPath))
				throw new InvalidOperationException("Configuration argument 'ReferencesPath' is not set.");

			Args.RelatedPath.CreateDirectoryIfNotExists();
			Args.ReferencesPath.CreateDirectoryIfNotExists();

			Console.Write("Converting paths for related projects... ");

			var project = new ProjectDocument(path);

			var references = project.GetProjectReferences();
			if (references.Count == 0)
				throw new InvalidOperationException("It is strange that cloud service or fabric application does not have any referenced projects.");

			var log = new LogPackages();
			foreach (var reference in references)
			{
				SetupRelatedProject(reference, log);
			}

			project.Save();
			Console.WriteLine("OK");

			log.Report();

			Console.Write("Saving local references... ");
			log.SaveReferences(Args.ReferencesPath);
			Console.WriteLine("OK");

			Console.Write("Saving packages summary... ");
			log.SaveSummary(Args.TempPath);
			Console.WriteLine("OK");
		}