Search code examples
visual-studio-2013nugetnuget-packagenuget-server

Nuget Package download and add to the reference


I am hosting my own nuget server to download the packages. I have package which copies some dlls to the bin folder of the specified project. This all works fine.

Is there anyway to add references automatlically to the dll when installing the package?


Solution

  • Any assemblies placed in the lib target in your nuspec file will be automatically added as an assembly reference to the installed project.

    <files>
       <file src="MyAssembly.dll" target="lib\net40" />
    </files>
    

    Alternatively, you can specify what files need to be added as assembly references in the references element of the nuspec file, like so:

    <references>
        <reference file="MyAssembly.dll" />
    </references>
    

    See the NuSpec Reference for more details.