protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); foreach (string fullPath in ResolvePaths(_paths, _shouldExpandWildcards)) { byte[] content = File.ReadAllBytes(fullPath); if (Async.ToBool() && CrmVersionManager.IsSupported(CrmVersion.CRM2015_RTM)) { ExecuteAction(fullPath, delegate { Guid importjobid = Guid.NewGuid(); OrganizationResponse response = _repository.ExecuteAsync("ImportSolution", new Hashtable() { { "CustomizationFile", content }, { "ImportJobId", importjobid }, { "ConvertToManaged", ConvertToManaged.ToBool() }, { "OverwriteUnmanagedCustomizations", Overwrite.ToBool() }, { "PublishWorkflows", PublishWorkflows.ToBool() }, { "SkipProductUpdateDependencies", SkipDependencies.ToBool() } }); WriteObject(_repository.Get("asyncoperation", (Guid)response.Results["AsyncJobId"])); }); } else { ExecuteAction(fullPath, delegate { Guid importjobid = Guid.NewGuid(); _repository.Execute("ImportSolution", new Hashtable() { { "CustomizationFile", content }, { "ImportJobId", importjobid }, { "ConvertToManaged", ConvertToManaged.ToBool() }, { "OverwriteUnmanagedCustomizations", Overwrite.ToBool() }, { "PublishWorkflows", PublishWorkflows.ToBool() }, { "SkipProductUpdateDependencies", SkipDependencies.ToBool() } }); WriteObject(_repository.Get("importjob", importjobid)); }); } } }