SQLitePCL.raw icon indicating copy to clipboard operation
SQLitePCL.raw copied to clipboard

Proposed changes to .targets files

Open ericsink opened this issue 8 years ago • 0 comments

Copied and pasted from a comment on #154 by @natemcmaster:

Don't rely on "$(OS)" to determine if you are building for windows. With the .NET Core CLI, you can build a Windows app on Linux and a Linux app on Windows. $(OS) determines the the OS running MSBuild, $(RuntimeIdentifier) determines which OS the app targets.

Also, you might consider changing the .targets file to something like this:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
  <None Include="$(MSBuildThisFileDirectory)..\runtimes\win7-x86\native\e_sqlite3.dll">
    <Link>x86\e_sqlite3.dll</Link>
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    <Visible>false</Visible>
  </None>
  <None Include="$(MSBuildThisFileDirectory)..\runtimes\win7-x64\native\e_sqlite3.dll">
    <Link>x64\e_sqlite3.dll</Link>
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    <Visible>false</Visible>
  </None>
</ItemGroup>
</Project>

This has the advantage of not relying on target chaining (a common source of failures). None items do not end up in NuGet packages (i.e. Pack defaults to true on Content, false on None). Visible=false hides the file from Solution Explorer.

ericsink avatar Apr 29 '17 17:04 ericsink