private static void SetupRelatedProject(ProjectReference reference, LogPackages log)
{
var fileName = Path.GetFileName(reference.Include);
var localName = Path.GetFileName(Path.GetDirectoryName(reference.Include));
var referenceName = reference.Name;
// another hardcode for resolving the names quickly
if (String.IsNullOrEmpty(referenceName))
{
referenceName = localName;
if (referenceName.StartsWith("Metro.")
|| referenceName.StartsWith("FlexQueue."))
{
referenceName = "CnetContent." + localName;
}
}
var includePath = Path.Combine(Args.RelatedPath, localName, fileName);
// quick dirty hardcode below with calling tools with specific paths and arguments
var blobVersion = String.Format("{0}/version.txt", referenceName);
var localVersion = String.Format(@"{0}\{1}.txt", Args.RelatedPath, localName);
Execute.Run(
"CCNet.Build.AzureDownload.exe",
String.Format(
@"Storage=Devbuild Container=build ""BlobFile={0}"" ""LocalFile={1}""",
blobVersion,
localVersion));
var version = File.ReadAllText(localVersion);
var blobSnapshot = String.Format("{0}/{1}/{0}.snapshot.zip", referenceName, version);
var localSnapshot = String.Format(@"{0}\{1}.zip", Args.RelatedPath, localName);
Execute.Run(
"CCNet.Build.AzureDownload.exe",
String.Format(
@"Storage=Devbuild Container=snapshot ""BlobFile={0}"" ""LocalFile={1}""",
blobSnapshot,
localSnapshot));
var localFolder = String.Format(@"{0}\{1}", Args.RelatedPath, localName);
Execute.Run(
@"C:\Program Files\7-Zip\7z.exe",
String.Format(@"x ""-o{0}"" ""{1}""", localFolder, localSnapshot));
reference.UpdateLocation(includePath);
log.Add(
referenceName,
new LogPackage
{
PackageId = referenceName,
ProjectName = referenceName,
ProjectUrl = String.Format("http://rufc-devbuild.cneu.cnwk/ccnet/server/Azure/project/{0}/ViewProjectReport.aspx", referenceName),
IsLocal = true,
SourceVersion = null,
BuildVersion = new Version(version),
ProjectReference = true
});
}