New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet pack on csproj ignores empty files element in nuspec file #3257

Closed
arnovannijnatten opened this Issue Aug 1, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@arnovannijnatten

arnovannijnatten commented Aug 1, 2016

Since NuGet client 3.4.4 the behavior of the pack command has changed and is not in line with the documentation anymore.

Before 3.4.4 it was possible to only include the output assembly and ignore content files in the nupkg by adding an empty files element in the nuspec file. From the docs (https://docs.nuget.org/Create/Creating-and-Publishing-a-Package#creating-a-package):

Note that only the files defined inside the node will be included in the package. If you include an empty node in the nuspec, all content files will be omitted from the package and only the lib folder will be included.

See attached solution and its build output which reproduces this with 3.2.0, 3.4.3 (both working as expected) and 3.4.4 and 3.5.2 (both showing the bug).
BuildOutput.txt
NuGetClientIssueRepro.zip

It seems this change in behavior was introduced by fixing #2658
Also see NuGet/NuGet.Client@c2443fd for reference

arnovannijnatten referenced this issue in NuGet/NuGet.Client Aug 1, 2016

Content files in referenced projects are not always included
If there are no content files in the main project but there are content file in a referenced project, they will be missed during pack.  Also, if there are content files in a project file without referenced projects but not in the nuspec, the content files will be missed.  This change takes out the nuspec check and just always looks for content files so that they aren't ever missed.

@rrelyea rrelyea added this to the 3.6 Beta2 milestone Sep 7, 2016

@rrelyea

This comment has been minimized.

Show comment
Hide comment
@rrelyea

rrelyea Sep 7, 2016

Contributor

Please analyze if we do have a break in behavior here.

Contributor

rrelyea commented Sep 7, 2016

Please analyze if we do have a break in behavior here.

@rohit21agrawal rohit21agrawal modified the milestones: 3.5 RTM, 3.6 Beta2 Sep 7, 2016

rohit21agrawal added a commit to NuGet/NuGet.Client that referenced this issue Sep 7, 2016

allow nuspec files element to override what content files are added w…
…hile packing using csproj (#860)

Fixes: NuGet/Home#3257

This bug was introduced because of fixing the bug from NuGet/Home#2658 commit 10a986f

manifest.Files != null was not a good enough check as Files was always initialized to an empty list upon creation of a Manifest object. This replaces that check with the better manifest.HasFilesNode which knows if the element is present or not in the nuspec. If an empty files element is present in the nuspec, then content is not added at all .

Since this is a regression, this fix will also go into 3.5-rtm branch.

rohit21agrawal added a commit to NuGet/NuGet.Client that referenced this issue Sep 7, 2016

allow nuspec files element to override what content files are added w…
…hile packing using csproj (#860)

Fixes: NuGet/Home#3257

This bug was introduced because of fixing the bug from NuGet/Home#2658 commit 10a986f

manifest.Files != null was not a good enough check as Files was always initialized to an empty list upon creation of a Manifest object. This replaces that check with the better manifest.HasFilesNode which knows if the element is present or not in the nuspec. If an empty files element is present in the nuspec, then content is not added at all .

Since this is a regression, this fix will also go into 3.5-rtm branch.
@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal
Contributor

rohit21agrawal commented Sep 7, 2016

@stevenscreek

This comment has been minimized.

Show comment
Hide comment
@stevenscreek

stevenscreek Sep 8, 2016

This looks like it should have fixed #3149 as well.

stevenscreek commented Sep 8, 2016

This looks like it should have fixed #3149 as well.

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Sep 8, 2016

Contributor

@stevenscreek yes it does look like these are the same issues and this should fix that one too!

Contributor

rohit21agrawal commented Sep 8, 2016

@stevenscreek yes it does look like these are the same issues and this should fix that one too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment