dotnet / NuGet.BuildTasks

The build tasks used to pick up package content from project.lock.json.
MIT License
45 stars 61 forks source link

ContentFiles: Embedded resources are always flattened #78

Open nkolev92 opened 4 years ago

nkolev92 commented 4 years ago

When a NuGet package is created with content files in a nested directory structure, the (manifest) resource names of the embedded resources that are created for these files do not contain the relative directory path (with slashes converted to dots).

Steps to reproduce:

  1. Create a NuGet package with the following content:
contentFiles
                any
                        any
                                sub
                                       myResource.txt
  1. In the .nuspec for this package, add the following fragment to the metadata element:
   <contentFiles>
        <files include="**" buildAction="EmbeddedResource" />
    </contentFiles>
  1. Pack & Publish the NuGet package.
  2. Create (for example) a C# Console App project named ConsoleApp1 (with default namespace ConsoleApp1¨) in Visual Studio (15.8).
  3. Ensure that the default package management format is PackageReference in the *NuGet Package Manager Settings**.
  4. Add a reference to the NuGet package that we published in step 3.
  5. Build the project.

Expected result:

The myResource.txt file is embedded in the ConsoleApp1.exe assembly with the name 'ConsoleApp1.sub.myResource.txt'.

Actual result:

The myResource.txt file is embedded in the ConsoleApp1.exe assembly with the name 'ConsoleApp1.myResource.txt'.

NuGet product used: VS UI (15.8.1) OS version: Windows 7 Build 7601

Moved from: https://github.com/NuGet/Home/issues/7255

cc @drieseng @tmeschter