private void ValidateLicenseFile(IEnumerable <IPackageFile> files, LicenseMetadata licenseMetadata) { if (!PackageTypes.Contains(PackageType.SymbolsPackage) && licenseMetadata?.Type == LicenseType.File) { var ext = Path.GetExtension(licenseMetadata.License); if (!string.IsNullOrEmpty(ext) && !ext.Equals(".txt", StringComparison.OrdinalIgnoreCase) && !ext.Equals(".md", StringComparison.OrdinalIgnoreCase)) { throw new PackagingException(NuGetLogCode.NU5031, string.Format(CultureInfo.CurrentCulture, NuGetResources.Manifest_LicenseFileExtensionIsInvalid, licenseMetadata.License)); } var strippedLicenseFileLocation = PathUtility.StripLeadingDirectorySeparators(licenseMetadata.License); var count = files.Where(e => PathUtility.StripLeadingDirectorySeparators(e.Path).Equals(strippedLicenseFileLocation, PathUtility.GetStringComparisonBasedOnOS())).Count(); if (count == 0) { throw new PackagingException(NuGetLogCode.NU5030, string.Format(CultureInfo.CurrentCulture, NuGetResources.Manifest_LicenseFileIsNotInNupkg, licenseMetadata.License)); } } }