We create and host NuGet packages in-house, with source code and deep dependency trees. I'm having some issues getting dependencies to "behave".
For clarity, this is specifically installing packages via VS or Rider into a .Net Core / PackageReference project. I don't expect it to be a VS/Rider/etc bug, so much as we're doing something slightly wrong.
Scenario:
- Create “Package A” using the PackageReference style compilation of
“contentFiles/any/any”.
- Create a sub-folder under “contentFiles/any/any” called “Source”.
- Place source code files in the “Source” folder.
- Have a dependency on “Package B”.
- Create “Package B”, again using the PackageReference style, with a “Source” subfolder.
- Place source code files in its “Source” folder.
- Pack and publish both.
Expectation:
- Install “Package A” (using the built-in NuGet package manager UI).
- Your project gains a “Source” folder.
- A’s source files are referenced into the new “Source” folder and compile with the project.
- “Package B” is also installed, since it’s a dependency.
- B’s source files are also referenced into the “Source” folder and compile with the project.
- Package A is immediately consumable by the project because all of its code, and all of its dependency’s code, is present.
Actual:
- Install “Package A”.
- Your project gains a “Source” folder.
- A’s source files are referenced into the new “Source” folder and compile with the project.
- “Package B” is also installed, since it’s a dependency.
- B’s source files are not referenced into the “Source” folder.
- Package A code cannot be compiled because the source for B is not in the project.
- Manually install “Package B”, same as you did for “A”.
- B’s source files are referenced into the new “Source” folder in the project.
- Now “Package A” can be compiled and consumed.
If sample nuspec files are needed, etc. please let me know.
Thanks
(This is a cross-post from https://github.com/NuGet/Home/issues/8858. No replies for a week)