nuget packages from project referenced using project reference not added

Sep 20, 2011 at 10:11 AM

I'm almost 100% sure, the first version of nuget 1.5 was able to handle the follow situation:

Project A -> uses nuget package common.1

Project B -> project reference A

create nuspec using commandline from B.csproj ( nuget spec B.csproj )
create package using commandline from B.csproj (nuget pack B.csproj )

Common.1 should be added as dependency...

But with the latest version , this does not work anymore. 

Sep 20, 2011 at 10:02 PM

Nothing significant changed between the 2 or 3 releases of 1.5 (they were more VSIX packaging issues). My think this scenario just doesn't work with the current code. There are clearly many improvements that can be made to the workflow when using a csproj (and I think there are issues tracking various things).

Sep 20, 2011 at 10:16 PM

Very strange, I'm almost sure I tested this scenario, because this was the single feature that was missing from 1.4, which prevented us from getting started with nuget in our company. 
Btw, are there any issues known, where an assembly from the lib folder in a package does not get added as a reference, although it was expected? We have one project, containing nothing but resources, from which we've created a package, and when adding this package to another project, no reference to the assembly gets added. Tried to reproduce it with another project with one resource, but this one gets added...
Is don't know if there is an option in nuget, to log package install to a file, so one can see the reason why it is skipped? If there isn't, maybe this would be a good idea to add..... eg. for log : assembly XXX skipped : assembly target .NET framework differs from current project .Net framework (sl40 != net40)

Sep 20, 2011 at 10:46 PM

In your first mail, you wrote "Project B -> project reference A", and this could mean different things: is it a project reference, or a reference to the NuGet package produced by A? If it's the latter, then I would in fact expect things to work (and it should have worked in 1.4 too).

To remove any ambiguities, you may want to share out a sample project that demonstrates the issue.

Sep 21, 2011 at 6:35 AM

You can find an example here :
One solution, ProjectA and ProjectB. ProjectB has a project reference A, A has a package reference for structuremap.
Inside ProjectB is a cmd file for creating nuspec and package file for ProjectB (create_spec_and_package.cmd), the package which I created ProjectB.1.0.nupkg, is also in this folder and when you open this package, you can see there is no dependency for structuremap package.

Sep 21, 2011 at 7:03 AM

Where does Cevi.Common.Data.ValidationException come from? It doesn't seem to be defined anywhere, so I can't even get your project to build.

Sep 21, 2011 at 7:21 AM

Sorry, my mistake, ProjectA contained initially a package reference to a package in our local repository...  I replaced this by Structuremap package, but forgot to change the code...

I uploaded the file again :

Sep 21, 2011 at 8:04 AM

Looks like that indeed doesn't work. You can even simplify your repro and just have Project B depend on Project A, and project A's assembly won't end up in B's package. The fact that A has a package dependency on top of that is not all that relevant to the scenario.

The best workaround for now is to manually add the relevant missing things to the nuspec. But we do need to improve this workflow in the future. See this related bug.