Exemplo n.º 1
0
        public DeploymentTarget(
            [NotNull] string id,
            [NotNull] string name,
            [NotNull] string packageId,
            string publishSettingsXml    = null,
            bool allowExplicitPreRelease = false,
            string nuGetConfigFile       = null,
            string nuGetPackageSource    = null,
            string uri = null,
            string environmentConfiguration = null,
            string organization             = null,
            string project         = null,
            bool autoDeployment    = false,
            string environmentType = null,
            bool autoDeployEnabled = false,
            StringValues emailNotificationAddresses  = default,
            Dictionary <string, string[]> parameters = null,
            string publishSettingFile   = null,
            string targetDirectory      = null,
            string parameterFile        = null,
            bool isReadOnly             = false,
            string iisSiteName          = default,
            string webConfigTransform   = default,
            string excludedFilePatterns = default,
            bool enabled = false)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(id));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
            }

            if (string.IsNullOrWhiteSpace(packageId))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(packageId));
            }

            if (Uri.TryCreate(uri, UriKind.Absolute, out Uri parsedUri))
            {
                Url = parsedUri;
            }

            EnvironmentConfiguration = environmentConfiguration;
            AutoDeployment           = autoDeployment;
            AutoDeployEnabled        = autoDeployEnabled;
            PublishSettingFile       = publishSettingFile;
            TargetDirectory          = targetDirectory;
            ParameterFile            = parameterFile;
            IsReadOnly           = isReadOnly;
            IisSiteName          = iisSiteName;
            WebConfigTransform   = webConfigTransform;
            ExcludedFilePatterns = excludedFilePatterns;
            Enabled              = enabled;
            Organization         = organization ?? string.Empty;
            ProjectInvariantName = project ?? string.Empty;
            Name = name;
            Id   = id;
            AllowExplicitExplicitPreRelease = allowExplicitPreRelease;
            NuGetConfigFile            = nuGetConfigFile;
            NuGetPackageSource         = nuGetPackageSource;
            PackageId                  = packageId;
            PublishSettingsXml         = publishSettingsXml;
            EnvironmentType            = EnvironmentType.Parse(environmentType);
            EmailNotificationAddresses = emailNotificationAddresses.SafeToReadOnlyCollection();
            Parameters                 = parameters?.ToImmutableDictionary() ?? ImmutableDictionary <string, string[]> .Empty;
        }