File build/MyNugetPackage.targets
is injected into the MSBuild project that references this nuget package.
Here is an example to copy *.dll files and reference them.
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<NativeLibs Include="$(MSBuildThisFileDirectory)**\*.dll" />
<None Include="@(NativeLibs)">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="MyAssembly">
<HintPath>MyAssembly.dll</HintPath>
</Reference>
<Reference Include="MyOtherAssembly">
<HintPath>MyOtherAssembly.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Include all output files to package directories.
<Target Name="IncludeAllFilesInTargetDir" AfterTargets="Build">
<ItemGroup>
<None Include="$(TargetDir)\**">
<Pack>true</Pack>
<PackagePath>lib</PackagePath>
</None>
<None Include="$(TargetDir)\**">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
</None>
<None Include="build/MyPackage.targets">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
</None>
</ItemGroup>
</Target>