Before I go into the problem, let me quickly explain my goal:
I have a template project that I use for each website that I build, which includes base classes, common pages (e.g. contact us), useful utilities (exception logging), etc. I want to make this template reusable and updatable. Previously I was using a Visual Studio Project Template, but I had issues in referencing all of the assemblies I needed, so I turned to Nuget. I was under the impression that this would be easier, and also provide me with additional benefits.
The problem:
I can't figure out how to create a nuget package that will include all references (both other projects within the solution and dlls on my local machine) in the package, and also make them dependencies in child projects that install this template.
This is how far I've gotten:
a. in the nuspec file for the project, I have the following:
<references>
<reference file="AjaxControlToolkit.dll" /> <!-- nuget dependency -->
<reference file="BjxContacts.Shared.dll" /> <!-- project dependency -->
<reference file="SomeExample.exe" /> <!-- exe local file dependency -->
<reference file="SomeOther.dll" /> <!-- dll local file dependency -->
</references>
<files>
<file src="bin\*.pdb" target="lib" />
<file src="bin\*.dll" target="lib"/>
<file src="bin\*.exe" target="lib"/>
<file src="bin\*.xml" target="lib"/>
</files>
b. When I run the pack command, I use this: nuget pack {projectname}.csproj - IncludeReferencedProjects -Symbols
c. The output is two separate projects, one with .symbols, and one without, which looks like this in Package Explorer:
So at this point, it feels like I'm doing everything right. But then, once I create a new empty web application in Visual Studio, and Install this package, none of these referenced assemblies or projects are included under references:
d. In new (child) project in Visual Studio:
I've hit a complete brick wall here. I've been searching the web for days, and I found a bunch of things that look like they might help, but bring me down dead ends:
- https://github.com/dittodhole/powershell-nuget-packager
- Build NuGet Package automatically including referenced dependencies
- NuGet Packaging and referencing dll's
- Why doesn't nuget include the referenced project when packing?
Where am I going wrong?
Update
In the .net451 folder, it adds all the external project references. As you can see in the WebApplication screenshot though, these references aren't added either.
(source: blabberjax.com)