Skip to content

Commit

Permalink
Allow sub folders under target framework folders
Browse files Browse the repository at this point in the history
  • Loading branch information
emgarten committed Feb 10, 2015
1 parent 6fb84c0 commit 1029d3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Packaging/PackageReaderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ protected IEnumerable<FrameworkSpecificGroup> GetFileGroups(string folder)
Dictionary<NuGetFramework, List<string>> groups = new Dictionary<NuGetFramework, List<string>>(new NuGetFrameworkFullComparer());

bool isContentFolder = StringComparer.OrdinalIgnoreCase.Equals(folder, PackagingConstants.ContentFolder);
bool allowSubFolders = true;

foreach (string path in GetFiles(folder))
{
NuGetFramework framework = NuGetFramework.Parse(GetFrameworkFromPath(path, isContentFolder));
NuGetFramework framework = NuGetFramework.Parse(GetFrameworkFromPath(path, allowSubFolders));

// Content allows both random folder names and framework folder names.
// It's nearly impossible to tell the difference and stay consistent over
Expand Down
18 changes: 18 additions & 0 deletions test/Packaging.Test/PackageReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ namespace NuGet.Test
{
public class PackageReaderTests
{
[Fact]
public void PackageReader_NestedReferenceItems()
{
var zip = TestPackages.GetZip(TestPackages.GetLibSubFolderPackage());

using (PackageReader reader = new PackageReader(zip))
{
var groups = reader.GetReferenceItems().ToArray();

Assert.Equal(1, groups.Count());

Assert.Equal(NuGetFramework.Parse("net40"), groups[0].TargetFramework);
Assert.Equal(2, groups[0].Items.Count());
Assert.Equal("lib/net40/test40.dll", groups[0].Items.ToArray()[0]);
Assert.Equal("lib/net40/x86/testx86.dll", groups[0].Items.ToArray()[1]);
}
}

[Fact]
public void PackageReader_MinClientVersion()
{
Expand Down

0 comments on commit 1029d3c

Please sign in to comment.