-
Notifications
You must be signed in to change notification settings - Fork 263
Description
This is really two bugs: The files chosen automatically for inclusion when packing may contain duplicates. And, NuGet.exe
emits warnings about the duplicates despite the user making no explicit choices.
Though these are "just warnings" it's very annoying, especially when a repo contains lots of packable projects. And, affected solutions have no workaround except completely changing the layout of their output folders.
/cc @rohit21agrawal @emgarten
/fyi @anurse
Details about Problem
NuGet.exe
- NuGet version:
4.3.0.4406
- OS version:
Win10 Enterprise v1703 (15063.632)
- Worked before?: Not sure when it worked. But, it must have because the directory layout involved has been really common in our (Microsoft's) solutions.
Detailed repro steps so we can see the same problem
- Clone the aspnet/WebHooks repo
.\build.cmd
Expected
Clean build
Actual
About 130 warnings, all similar to
EXEC : warning : File 'WebHooks\bin\CodeAnalysis\Test\Microsoft.AspNet.WebHooks.Common.dll' is not
added because the package already contains file 'lib\net45\Microsoft.AspNet.WebHooks.Common.dll' [WebHooks\src\Packages\Packages.proj]
Other suggested things
Likely root cause
Problem is caused by nesting of output directories and the wildcard search in PackCommandRunner
’s GetFiles(…)
method.
In this solution, most projects use an $(OutputPath)
setting to $(WebHooksRootPath)bin\$(Configuration)\
in tools\WebHooks.settings.targets
. Test projects individually (e.g. here) set $(OutputPath)
to ..\..\bin\$(Configuration)\Test\
. In other words, the test projects write assembly files et cetera into a subdirectory of the usual output folder.