private string CustomValidate() { var errors = new List <string>(); if (PublicKeyPath != null && !File.Exists(PublicKeyPath)) { errors.Add($"Public key file '{PublicKeyPath}' doesn't exists"); } if (PublicKeyPath == null && PublicKey == null) { errors.Add("Public key should be specified in key or key-path parameter"); } if (PublicKeyPath != null && PublicKey != null) { errors.Add("Source of the public key should be specified in key or key-path parameter"); } if (EncryptionTargetPath != null && !PathExists(EncryptionTargetPath)) { errors.Add($"Target '{EncryptionTargetPath}' doesn't exists"); } if (OutputAssemblyPath != null) { if (!Directory.Exists(Path.GetDirectoryName(OutputAssemblyPath) ?? "")) { errors.Add($"Output directory '{OutputAssemblyPath}' doesn't exist"); } if (!OutputAssemblyPath.ToLowerInvariant().EndsWith(".exe")) { errors.Add($"Output assembly path `{OutputAssemblyPath}` should point to executable with extension 'exe'"); } } if (ContentVersion != null && !Regex.IsMatch(ContentVersion, @"^(\d\.){3}\d$")) { errors.Add("Content version parameter should be in '1.1.1.1' format"); } return(errors.Any() ? string.Join(Environment.NewLine, errors) : null); }
private string CustomValidate() { var errors = new List <string>(); if (PublicKeyPath != null && !File.Exists(PublicKeyPath)) { errors.Add("Public key file doesn't exists"); } if (PublicKeyPath == null && PublicKey == null) { errors.Add("Public key should be specified in key or key-path parameter"); } if (PublicKeyPath != null && PublicKey != null) { errors.Add("Source of the public key should be specified in key or key-path parameter"); } if (EncryptionTargetPath != null && !PathExists(EncryptionTargetPath)) { errors.Add("Target doesn't exists"); } if (OutputAssemblyPath != null) { if (!Directory.Exists(Path.GetDirectoryName(OutputAssemblyPath) ?? "")) { errors.Add("Output directory doesn't exist"); } if (!OutputAssemblyPath.ToLowerInvariant().EndsWith(".exe")) { errors.Add("Output assembly path should point to executable with extension 'exe'"); } } return(errors.Any() ? string.Join(Environment.NewLine, errors) : null); }