public string CreateDiffBuildLayout(string[] includedComponentVersions) { string tempDirectory = Path.Combine(TestDirectory, "FabricUnitTests", Guid.NewGuid().ToString()); try { Directory.CreateDirectory(tempDirectory); BuildLayoutSpecification tempBuildLayoutSpec = BuildLayoutSpecification.Create(); tempBuildLayoutSpec.SetRoot(tempDirectory); foreach (var serviceManifestType in this.ServiceManifestTypes) { if (!ShouldIncludeVersion(includedComponentVersions, serviceManifestType.Name, serviceManifestType.Version)) { continue; } if (serviceManifestType.CodePackage != null) { foreach (CodePackageType codePackage in serviceManifestType.CodePackage) { if (!ShouldIncludeVersion(includedComponentVersions, codePackage.Name, codePackage.Version)) { continue; } string codeFolderName = tempBuildLayoutSpec.GetCodePackageFolder( serviceManifestType.Name, codePackage.Name); string pathInCodeFolder = Path.Combine(codeFolderName, "Test Path"); Directory.CreateDirectory(codeFolderName); Directory.CreateDirectory(pathInCodeFolder); File.Copy( Path.Combine(TestDirectory, "System.Fabric.Management.dll"), Path.Combine(codeFolderName, string.Format("System.Fabric.Management.{0}.dll", serviceManifestType.Name)), true); File.Copy( Path.Combine(TestDirectory, "System.Fabric.Management.dll"), Path.Combine(codeFolderName, "Setup.exe"), true); File.Copy( Path.Combine(TestDirectory, "System.Fabric.Management.dll"), Path.Combine(pathInCodeFolder, "TestLib.exe"), true); } } if (serviceManifestType.ConfigPackage != null) { foreach (ConfigPackageType configPackage in serviceManifestType.ConfigPackage) { if (!ShouldIncludeVersion(includedComponentVersions, configPackage.Name, configPackage.Version)) { continue; } string configFolderName = tempBuildLayoutSpec.GetConfigPackageFolder( serviceManifestType.Name, configPackage.Name); Directory.CreateDirectory(configFolderName); if (this.SettingsType != null) { string settingsFileName = tempBuildLayoutSpec.GetSettingsFile(configFolderName); TestUtility.WriteXml <SettingsType>(settingsFileName, this.SettingsType); } else { File.Copy( Path.Combine(TestDirectory, "System.Fabric.Management.dll"), Path.Combine(configFolderName, "MyConfig.xml"), true); } } } if (serviceManifestType.DataPackage != null) { foreach (DataPackageType dataPackage in serviceManifestType.DataPackage) { if (!ShouldIncludeVersion(includedComponentVersions, dataPackage.Name, dataPackage.Version)) { continue; } string dataFolderName = tempBuildLayoutSpec.GetDataPackageFolder( serviceManifestType.Name, dataPackage.Name); Directory.CreateDirectory(dataFolderName); File.Copy( Path.Combine(TestDirectory, "System.Fabric.Management.dll"), Path.Combine(dataFolderName, "MyData.exe"), true); } } string serviceManifestFilePath = tempBuildLayoutSpec.GetServiceManifestFile(serviceManifestType.Name); string serviceManifestDirectory = Path.GetDirectoryName(serviceManifestFilePath); if (!Directory.Exists(serviceManifestDirectory)) { Directory.CreateDirectory(serviceManifestDirectory); } TestUtility.WriteXml <ServiceManifestType>( tempBuildLayoutSpec.GetServiceManifestFile(serviceManifestType.Name), serviceManifestType); } string appManifestFilePath = tempBuildLayoutSpec.GetApplicationManifestFile(); string appManifestDirectory = Path.GetDirectoryName(appManifestFilePath); if (!Directory.Exists(appManifestDirectory)) { Directory.CreateDirectory(appManifestDirectory); } TestUtility.WriteXml <ApplicationManifestType>( tempBuildLayoutSpec.GetApplicationManifestFile(), this.ApplicationManifestType); this.ImageStore.DeleteContent(this.ApplicationFolderName, TimeSpan.MaxValue); this.ImageStore.UploadContent(this.ApplicationFolderName, tempDirectory, TimeSpan.MaxValue, CopyFlag.AtomicCopy, false); } finally { if (Directory.Exists(tempDirectory)) { Directory.Delete(tempDirectory, true); } } return(this.ApplicationFolderName); }