Microsoft.WindowsAzure.Commands.Utilities.CloudService.CloudServiceProject.Reload C# (CSharp) Method

Reload() public method

Reloads the cloud service project configuration from the disk.
public Reload ( ) : void
return void
        public void Reload()
        {
            Components = new ServiceComponents(Paths);
        }
    }

Usage Example

        public WorkerRole AddAzureCacheWorkerRoleProcess(string workerRoleName, int instances, string rootPath)
        {
            // Create cache worker role.
            Action<string, RoleInfo> cacheWorkerRoleAction = CacheConfigurationFactory.GetCacheRoleConfigurationAction(
                AzureTool.GetAzureSdkVersion());

            CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null);
            
            RoleInfo genericWorkerRole = cloudServiceProject.AddWorkerRole(
                Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()),
                workerRoleName,
                instances);

            // Dedicate the worker role for caching.
            cacheWorkerRoleAction(cloudServiceProject.Paths.RootPath, genericWorkerRole);

            cloudServiceProject.Reload();
            WorkerRole cacheWorkerRole = cloudServiceProject.Components.GetWorkerRole(genericWorkerRole.Name);

            // Write output
            SafeWriteOutputPSObject(
                cacheWorkerRole.GetType().FullName,
                Parameters.CacheWorkerRoleName, genericWorkerRole.Name,
                Parameters.Instances, genericWorkerRole.InstanceCount
                );

            return cloudServiceProject.Components.GetWorkerRole(workerRoleName);
        }