public override void AddPackage(IPackage package) { if (base.PackageSaveMode.HasFlag(PackageSaveModes.Nuspec)) { string manifestFilePath = this.GetManifestFilePath(package.Id, package.Version); Manifest manifest = Manifest.Create(package); manifest.Metadata.ReferenceSets = Enumerable.Select <IGrouping <FrameworkName, IPackageAssemblyReference>, ManifestReferenceSet>(from f in package.AssemblyReferences group f by f.TargetFramework, delegate(IGrouping <FrameworkName, IPackageAssemblyReference> g) { ManifestReferenceSet set1 = new ManifestReferenceSet(); ManifestReferenceSet set2 = new ManifestReferenceSet(); set2.TargetFramework = (g.Key == null) ? null : VersionUtility.GetFrameworkString(g.Key); ManifestReferenceSet local2 = set2; ManifestReferenceSet local3 = set2; local3.References = Enumerable.Select <IPackageAssemblyReference, ManifestReference>(g, delegate(IPackageAssemblyReference p) { ManifestReference reference1 = new ManifestReference(); reference1.File = p.Name; return(reference1); }).ToList <ManifestReference>(); return(local3); }).ToList <ManifestReferenceSet>(); this.FileSystem.AddFileWithCheck(manifestFilePath, new Action <Stream>(manifest.Save)); } if (base.PackageSaveMode.HasFlag(PackageSaveModes.Nupkg)) { string packageFilePath = this.GetPackageFilePath(package); this.FileSystem.AddFileWithCheck(packageFilePath, new Func <Stream>(package.GetStream)); } }
private static List <ManifestReference> CreateReferences(PackageReferenceSet referenceSet) => ((referenceSet.References != null) ? Enumerable.Select <string, ManifestReference>(referenceSet.References, delegate(string reference) { ManifestReference reference1 = new ManifestReference(); reference1.File = reference.SafeTrim(); return(reference1); }).ToList <ManifestReference>() : new List <ManifestReference>());