I have created a T4 template that I want to reuse in several projects using NuGet. This template is based on a custom class so I need to distribute a DLL with the template. The DLL is used by the template during generation, but is not used by the project itself so I do NOT want it added to the target project as a reference.
My .nuspec file includes my DLL and places it in the root of the package which will prevent it from creating a reference and everything works fine if I build my package by hand. Unfortunately, I want to use the "nuget pack" command to automatically pick up the version number. When I run this command and reference the project file, it includes my DLL twice, once in the root (as I specified in my nuspec file) and an additional time in the lib folder (along with everything in the bin folder).
How can I automatically build my NuGet package without including any references. It seems there are several solutions, but I can't figure any of them out:
- Let nuget include my DLL in the lib folder, but prevent it from creating the reference. I know I can use the
<references>
section to reference some DLLs and not others, but in this case I don't want it to reference any. If I leave the<references>
section blank it is either ignored or I get an error depending on what level I leave blank. - Prevent nuget from including any DLLs automatically and only include the files in the
<files>
section of the nuspec file. Unfortunately, I can't figure out how to build the package from the project file without it including my DLL automatically.
Any thoughts?