My problem is that I have an unmanaged library in a nuget package that I want to copy in the publish folder of the API that embed it.
Here is a StackoverFlow post that I thought it could work as the final goal seems to be the same as me : Include Unmanaged DLL from Nuget package to web Deploy package And here is how I tried to adapt it to my project :
<Target Name="AfterBuild" DependsOnTargets="CopyFilesToOutputDirectory">
<ItemGroup>
<MyPackageSourceFile Include="$(SolutionDir)Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll" />
</ItemGroup>
<Copy SourceFiles="@(MyPackageSourceFile)" DestinationFolder="$(OutputPath)" />
<Copy SourceFiles="@(MyPackageSourceFile)" DestinationFolder="$(ProjectDir)UnmanagedDll" />
</Target>
<Target Name="AddUnmanagedDll" AfterTargets="AfterBuild">
<ItemGroup>
<Content Include="UnmanagedDll\*.dll" />
</ItemGroup>
</Target>
But it doesn't do anything .
In a more common way I also tried something kind of this :
<ItemGroup>
<None Remove="Assemblies\libwkhtmltox\32 bits\libwkhtmltox.dll" />
<None Remove="Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll" />
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Include="Assemblies\libwkhtmltox\32 bits\libwkhtmltox.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<TargetPath>Assemblies\libwkhtmltox\32 bits\libwkhtmltox.dll</TargetPath>
</ContentWithTargetPath>
<ContentWithTargetPath Include="Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<TargetPath>Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
Maybe it could be important to specify that all the projects are in C# .NET CORE 2.1
Please tell me if you want any further information.