コード例 #1
0
        public UpdateDeploymentTarget(
            DeploymentTargetId id,
            bool allowExplicitPreRelease,
            string?url,
            string packageId,
            string?iisSiteName          = null,
            string?nugetPackageSource   = null,
            string?nugetConfigFile      = null,
            bool autoDeployEnabled      = false,
            string?publishSettingsXml   = null,
            string?targetDirectory      = null,
            string?webConfigTransform   = null,
            string?excludedFilePatterns = null,
            string?environmentTypeId    = null,
            string?packageListTimeout   = null,
            string?publishType          = null,
            string?ftpPath                  = null,
            string?metadataTimeout          = default,
            bool requireEnvironmentConfig   = default,
            string?environmentConfiguration = null,
            bool packageListPrefixEnabled   = false,
            string?packageListPrefix        = null)
        {
            Id = id;
            AllowExplicitPreRelease = allowExplicitPreRelease;
            Uri.TryCreate(url, UriKind.Absolute, out var uri);
            Url                  = uri;
            PackageId            = packageId?.Trim();
            ExcludedFilePatterns = excludedFilePatterns;
            PublishType.TryParseOrDefault(publishType, out var foundPublishType);
            FtpPath.TryParse(ftpPath, FileSystemType.Directory, out var path);
            PublishType        = foundPublishType ?? PublishType.Default;
            FtpPath            = path;
            IisSiteName        = iisSiteName;
            NugetPackageSource = nugetPackageSource;
            NugetConfigFile    = nugetConfigFile;
            AutoDeployEnabled  = autoDeployEnabled;
            PublishSettingsXml = publishSettingsXml;
            TargetDirectory    = targetDirectory;
            WebConfigTransform = webConfigTransform;
            IsValid            = Id != DeploymentTargetId.Invalid;
            EnvironmentTypeId  = environmentTypeId?.Trim();
            PackageListPrefix  = packageListPrefix;

            if (TimeSpan.TryParse(packageListTimeout, out var timeout) && timeout.TotalSeconds > 0.5D)
            {
                PackageListTimeout = timeout;
            }

            if (TimeSpan.TryParse(metadataTimeout, out var parsedMetadataTimeout) &&
                parsedMetadataTimeout.TotalSeconds > 0.5D)
            {
                MetadataTimeout = parsedMetadataTimeout;
            }

            RequireEnvironmentConfig = requireEnvironmentConfig;
            EnvironmentConfiguration = environmentConfiguration;
            PackageListPrefixEnabled = packageListPrefixEnabled;
        }
コード例 #2
0
        public DeploymentExecutionDefinition(
            string packageId,
            string targetDirectoryPath,
            MayBe <SemanticVersion> semanticVersion,
            string nuGetConfigFile    = null,
            string nuGetPackageSource = null,
            string iisSiteName        = null,
            bool isPreRelease         = false,
            bool force = false,
            string environmentConfig   = null,
            string publishSettingsFile = null,
            Dictionary <string, string[]> parameters = null,
            string excludedFilePatterns   = null,
            bool requireEnvironmentConfig = false,
            string webConfigTransformFile = null,
            string publishType            = null,
            string ftpPath                = null,
            string nugetExePath           = null,
            string packageListPrefix      = null,
            bool?packageListPrefixEnabled = null)
        {
            SemanticVersion = semanticVersion ?? MayBe <SemanticVersion> .Nothing;
            if (string.IsNullOrWhiteSpace(packageId))
            {
                throw new ArgumentNullException(nameof(packageId));
            }

            ExcludedFilePatterns = excludedFilePatterns?.Split(';').ToImmutableArray() ?? ImmutableArray <string> .Empty;

            PackageId           = packageId;
            TargetDirectoryPath = targetDirectoryPath;
            NuGetConfigFile     = nuGetConfigFile;
            NuGetPackageSource  = nuGetPackageSource;
            IisSiteName         = iisSiteName;
            IsPreRelease        = SemanticVersion?.IsPrerelease ?? isPreRelease;
            Force                    = force;
            EnvironmentConfig        = environmentConfig;
            PublishSettingsFile      = publishSettingsFile;
            RequireEnvironmentConfig = requireEnvironmentConfig;
            WebConfigTransformFile   = webConfigTransformFile;
            Parameters               = parameters?.ToDictionary(pair => pair.Key,
                                                                pair => new StringValues(pair.Value ?? Array.Empty <string>()))
                                       .ToImmutableDictionary() ??
                                       ImmutableDictionary <string, StringValues> .Empty;

            _       = PublishType.TryParseOrDefault(publishType, out PublishType publishTypeValue);
            _       = FtpPath.TryParse(ftpPath, FileSystemType.Directory, out FtpPath path);
            FtpPath = path;

            PublishType = publishTypeValue;

            ExcludedFilePatternsCombined = excludedFilePatterns;

            NuGetExePath             = nugetExePath;
            PackageListPrefix        = packageListPrefix;
            PackageListPrefixEnabled = packageListPrefixEnabled;
        }