public async Task RunAsync() { var sfApplications = await _locator.LocateSfApplications().ConfigureAwait(false); await _fabricRemote.Init().ConfigureAwait(false); _log.WriteLine("Trying to read app manifest from deployed applications..."); var deployedApps = await _fabricRemote.GetApplicationManifestsAsync().ConfigureAwait(false); var currentVersion = _versionHandler.GetCurrentVersionFromApplications(deployedApps); var newVersion = currentVersion.Increment(_baseConfig.UniqueVersionIdentifier); _log.WriteLine($"New version is: {newVersion}", LogLevel.Info); var hackData = _hack.FindHackableThings(sfApplications.First()); var versions = new VersionMap { PackageVersions = new Dictionary <string, GlobalVersion> { [Constants.GlobalIdentifier] = new GlobalVersion { VersionType = VersionType.Global, Version = currentVersion } } }; var currentHashMap = await _versionMapHandler.GetAsync(currentVersion).ConfigureAwait(false); var parsedApplications = new Dictionary <string, ServiceFabricApplicationProject>(); _log.WriteLine("Parsing Service Fabric Applications and computing hashes"); foreach (var sfApplication in sfApplications) { var project = _projectHandler.Parse(sfApplication, _baseConfig.SourcePath); parsedApplications.Add(project.ApplicationTypeName, project); var serviceVersions = await _hasher.Calculate(project, currentVersion).ConfigureAwait(false); serviceVersions.ForEach(service => { versions.PackageVersions.Add(service.Key, service.Value); }); } if (_baseConfig.ForcePackageAll || currentHashMap?.PackageVersions == null) { _log.WriteLine($"Force package all, setting everything to {newVersion}"); _versionService.SetVersionIfNoneIsDeployed(versions, newVersion); } else { _log.WriteLine($"Setting version of changed packages to {newVersion}"); _versionService.SetVersionsIfVersionIsDeployed(currentHashMap, versions, newVersion); } _log.WriteLine("Packaging applications", LogLevel.Info); await _packager .PackageApplications(versions, parsedApplications, hackData) .ConfigureAwait(false); _log.WriteLine("Updating manifests"); _manifestReader.Handle(versions, parsedApplications); await _versionMapHandler.PutAsync(versions).ConfigureAwait(false); var things = versions .PackageVersions .Where(x => x.Value.VersionType == VersionType.Application) .Where(x => x.Value.IncludeInPackage) .Select(x => x.Key) .ToList(); _scriptCreator.Do(newVersion, things); }