Skip to content

Instantly share code, notes, and snippets.

@GeorgDangl
Created June 29, 2017 10:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeorgDangl/6007c8d2a9e920c954485774a5fd016c to your computer and use it in GitHub Desktop.
Save GeorgDangl/6007c8d2a9e920c954485774a5fd016c to your computer and use it in GitHub Desktop.
Using Microsoft.EntityFrameworkCore.Sqlite in a full .Net framework class library
$SQLitePackages = Join-Path -Path $env:USERPROFILE -ChildPath "\.nuget\packages\SQLite"
$latestSQLite3PackageX64 = Join-Path -Path ((Get-ChildItem -Path $SQLitePackages | Sort-Object Fullname -Descending)[0].FullName) -ChildPath "runtimes\win7-x64\native\sqlite3.dll"
$latestSQLite3PackageX86 = Join-Path -Path ((Get-ChildItem -Path $SQLitePackages | Sort-Object Fullname -Descending)[0].FullName) -ChildPath "runtimes\win7-x86\native\sqlite3.dll"
if (!(Test-Path "$PSScriptRoot\Dependencies")){
New-Item -ItemType Directory -Path "$PSScriptRoot\Dependencies"
}
if (!(Test-Path "$PSScriptRoot\Dependencies\x86")){
New-Item -ItemType Directory -Path "$PSScriptRoot\Dependencies\x86"
}
if (!(Test-Path "$PSScriptRoot\Dependencies\x64")){
New-Item -ItemType Directory -Path "$PSScriptRoot\Dependencies\x64"
}
Copy-Item -Path $latestSQLite3PackageX64 -Destination "$PSScriptRoot\Dependencies\x64\sqlite3.dll"
Copy-Item -Path $latestSQLite3PackageX86 -Destination "$PSScriptRoot\Dependencies\x86\sqlite3.dll"
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\Dependencies\x64\sqlite3.dll">
<Link>x64\sqlite3.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Dependencies\x86\sqlite3.dll">
<Link>x86\sqlite3.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.2" />
<PackageReference Include="SQLite" Version="3.13.0" />
<PackageReference Include="xunit" Version="2.3.0-beta4-build3710" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta4-build3710" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3710" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment