private void AddOutputFiles(PackageBuilder builder)
{
// Get the target framework of the project
FrameworkName targetFramework = TargetFramework;
// Get the target file path
string targetPath = TargetPath;
// List of extensions to allow in the output path
var allowedOutputExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
".dll",
".exe",
".xml"
};
if (IncludeSymbols)
{
// Include pdbs for symbol packages
allowedOutputExtensions.Add(".pdb");
}
string projectOutputDirectory = Path.GetDirectoryName(targetPath);
string targetFileName = Path.GetFileNameWithoutExtension(targetPath);
// By default we add all files in the project's output directory
foreach (var file in GetFiles(projectOutputDirectory, targetFileName, allowedOutputExtensions))
{
{
string extension = Path.GetExtension(file);
// Only look at files we care about
if (!allowedOutputExtensions.Contains(extension))
{
continue;
}
string targetFolder;
if (IsTool)
{
targetFolder = ToolsFolder;
}
else
{
if (targetFramework == null)
{
targetFolder = ReferenceFolder;
}
else
{
targetFolder = Path.Combine(ReferenceFolder, VersionUtility.GetShortFrameworkName(targetFramework));
}
}
builder.Files.Add(new PhysicalPackageFile
{
SourcePath = file,
TargetPath = Path.Combine(targetFolder, Path.GetFileName(file))
});
}
}
}