本文整理汇总了C#中PackageBuilder.PopulateFiles方法的典型用法代码示例。如果您正苦于以下问题:C# PackageBuilder.PopulateFiles方法的具体用法?C# PackageBuilder.PopulateFiles怎么用?C# PackageBuilder.PopulateFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageBuilder
的用法示例。
在下文中一共展示了PackageBuilder.PopulateFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildPackage
public void BuildPackage(string basePath, IList<string> includes, ManifestMetadata metadata, string outFolder, bool overwrite)
{
var nugetPkgBuilder = new PackageBuilder();
nugetPkgBuilder.PopulateFiles(basePath, includes.Select(i => new ManifestFile { Source = i }));
nugetPkgBuilder.Populate(metadata);
var filename = metadata.Id + "." + metadata.Version + ".nupkg";
var output = Path.Combine(outFolder, filename);
if (fileSystem.FileExists(output) && !overwrite)
throw new CommandException("The package file already exists and --overwrite was not specified");
log.Information("Saving {Filename} to {OutFolder}...", filename, outFolder);
fileSystem.EnsureDirectoryExists(outFolder);
using (var outStream = fileSystem.OpenFile(output, FileMode.Create))
nugetPkgBuilder.Save(outStream);
}
示例2: ProcessNuspec
private Manifest ProcessNuspec(PackageBuilder builder, string basePath)
{
string nuspecFile = GetNuspec();
if (String.IsNullOrEmpty(nuspecFile))
{
return null;
}
Logger.Log(MessageLevel.Info, NuGetResources.UsingNuspecForMetadata, Path.GetFileName(nuspecFile));
using (Stream stream = File.OpenRead(nuspecFile))
{
// Don't validate the manifest since this might be a partial manifest
// The bulk of the metadata might be coming from the project.
Manifest manifest = Manifest.ReadFrom(stream, this);
builder.Populate(manifest.Metadata);
if (manifest.Files != null)
{
basePath = String.IsNullOrEmpty(basePath) ? Path.GetDirectoryName(nuspecFile) : basePath;
builder.PopulateFiles(basePath, manifest.Files);
}
return manifest;
}
}