Page 1 of 1

Only Copy Platform Specific Native Binaries from NuGet

Posted: Wed Jun 01, 2022 4:44 pm
by accudave
Is it possible to have the GdPicture.NET team update the GdPicture.targets file in the NuGet package to only deploy the native binaries for the correct target platforms of the project?

SQLite does this, here is their targets file.

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'AnyCPU'">
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\*">
      <Link>x86\%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*">
      <Link>x64\%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x86'">
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\*">
      <Link>%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x64'">
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*">
      <Link>%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>
  </ItemGroup>
</Project>
Currently I am maintaining our own GdPicture.NET NuGet packages because I have NuGet packages for each of the optional components (barcodes, TWAIN, OCR).

It would be great of GdPicture.NET to organize this as well and have the following NuGet packages:

GdPicture (install all required files)
GdPicture.Barcode
GdPicture.Twain
GdPicture.OCR

Where all of them install only the required platform binaries.

I'm am on the fence of whether I want to use the official GdPicture.NET NuGet package yet because of all the extra binaries it produces.

Re: Only Copy Platform Specific Native Binaries from NuGet

Posted: Fri Jun 03, 2022 3:39 pm
by Fabio
Hello there,

This would be a nice improvement of our NuGet mechanism.
I created a task for our developers for implementing it.
I will keep you updated about any news regarding this implementation.

Thank you very much for your feedback!

Best regards,
Fabio