Following the advice in this answer, I tried to arrange for the native files to be installed in the output directory for a C# Console Application, but the copy step doesn't run.
My NuGet package contains the native files in the build
directory. The following Project.targets
file is also in the build
directory of the package:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><ItemGroup><NativeDependencies Include="$(MSBuildThisFileDirectory)*.*" Exclude="$(MSBuildThisFileDirectory)*.targets" /><None Include="@(NativeDependencies)"><Link>%(FileName)%(Extension)</Link><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></None></ItemGroup></Project>
I installed my NuGet package in the console application; there were no errors. I built the solution, but the native files were not copied/linked.
I see the Project.targets
file referenced in obj/Project.csproj.nuget.g.targets
, so seemingly there's an appropriate reference to Project.targets
, but it never runs:
<Import Project="$(NuGetPackageRoot)...\build\Project.targets" Condition="Exists('$(NuGetPackageRoot)...\build\Project.targets')" />
I set Visual Studio to run MSBuild with diagnostic level output, but see no mention of "Project.targets" or "NativeDependencies".
What have I missed?