I put together a NuGet package to deploy the Firebird Embedded dll files (attached). Through developing this I realized there are some difficulties when using with 'Any CPU' projects. To address this I created a separate patch that checks a process architecture specific folder for the client libraries (attached).

Firebird Embedded NuGet Package

* Requires the content of 32-bit embedded and 64-bit to be extracted to Firebird-2.5.2.26539-0_x64_embed and Firebird-2.5.2.26539-0_Win32_embed. (DL from http://www.firebirdsql.org/en/firebird-2-5-2/) * When added Installed runs PowerShell scripts that add an xcopy function to post build event (similarly to how SQL Server Compact Edition NuGet package does it) the xcopy copies both an x86 and AMD64 to the build location.
* When uninstalled removes the xcopy function from the post build event.


Search Process Architecture Folder for Client Library

*If the client dll is not specified and fbembed.dll exists in the %PROCESSOR_ARCHITECTURE% sub folder it will be used. Otherwise will revert to previous behavior.


Please let me if know you will be able to incorporate these patches and if I have submitted to you correctly.

Thanks,
Greg

Index: nuget/empty
===================================================================
Index: nuget/FirebirdSql.Data.FirebirdClient.Embedded.nuspec
===================================================================
--- nuget/FirebirdSql.Data.FirebirdClient.Embedded.nuspec       (revision 0)
+++ nuget/FirebirdSql.Data.FirebirdClient.Embedded.nuspec       (working copy)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd";>
+  <metadata>
+    <id>FirebirdSql.Data.FirebirdClient.Embedded</id>
+    <version>2.5.2.26539</version>
+    <title>Firebird Embedded</title>
+    <description>Firebird Embedded Dlls to be used with Firebird ADO.NET Data 
provider</description>
+    <authors>FirebirdSQL</authors>
+    <owners>FirebirdSQL</owners>
+    
<licenseUrl>http://firebird.svn.sourceforge.net/viewvc/firebird/NETProvider/trunk/NETProvider/license.txt</licenseUrl>
+    <projectUrl>http://www.firebirdsql.org/en/net-provider/</projectUrl>
+    
<iconUrl>http://www.firebirdsql.org/file/about/ds-firebird-logo-64.png</iconUrl>
+    <requireLicenseAcceptance>false</requireLicenseAcceptance>
+    <tags>firebird firebirsql firebirdclient adonet database</tags>
+    <dependencies>
+        <dependency id="FirebirdSql.Data.FirebirdClient" version="3.0.2.1" />
+    </dependencies>
+  </metadata>
+  <files>
+       <!-- In order to work correctly one or more files needs to be added to 
the lib folder -->
+        <file src="empty" target="lib\empty" />
+
+        <file src="install.ps1" target="tools\install.ps1" />
+        <file src="uninstall.ps1" target="tools\uninstall.ps1" />
+
+        <file src="Firebird-2.5.2.26539-0_Win32_embed\**\*.conf" 
target="other" />
+        <file src="Firebird-2.5.2.26539-0_Win32_embed\**\doc\*" target="other" 
/>
+        <file src="Firebird-2.5.2.26539-0_Win32_embed\**\*.txt" target="other" 
/>
+        <file src="Firebird-2.5.2.26539-0_Win32_embed\*License*.txt" target="" 
/>
+
+        <file src="Firebird-2.5.2.26539-0_Win32_embed\**\*" 
target="NativeBinaries\x86" exclude="**\*.conf;**\doc\*;**\*.txt" />
+        <file src="Firebird-2.5.2.26539-0_x64_embed\**\*" 
target="NativeBinaries\AMD64" exclude="**\*.conf;**\doc\*;**\*.txt" />
+  </files>
+</package>
\ No newline at end of file
Index: nuget/install.ps1
===================================================================
--- nuget/install.ps1   (revision 0)
+++ nuget/install.ps1   (working copy)
@@ -0,0 +1,20 @@
+param($installPath, $toolsPath, $package, $project)
+Write-Host install.ps1
+
+$solutionDir = [IO.Path]::GetDirectoryName($dte.Solution.FullName) + "\"
+$path = $installPath.Replace($solutionDir, "`$(SolutionDir)")
+$nativeAssembliesDir = Join-Path $path "NativeBinaries\*.*"
+
+$postBuildCmd = "
+xcopy /s /y `"$nativeAssembliesDir`" `"`$(TargetDir)`""
+
+#Add
+$currentPostBuildCmd = $project.Properties.Item("PostBuildEvent").Value
+# Append our post build command if it's not already there
+if (!$currentPostBuildCmd.Contains($postBuildCmd)) {
+   Write-Host Updating PostBuildEvent
+   $project.Properties.Item("PostBuildEvent").Value += $postBuildCmd
+}
+else {
+   Write-Host Skipped Updating PostBuildEvent
+}
\ No newline at end of file
Index: nuget/uninstall.ps1
===================================================================
--- nuget/uninstall.ps1 (revision 0)
+++ nuget/uninstall.ps1 (working copy)
@@ -0,0 +1,20 @@
+param($installPath, $toolsPath, $package, $project)
+write-host uninstall.ps1
+
+$solutionDir = [IO.Path]::GetDirectoryName($dte.Solution.FullName) + "\"
+$path = $installPath.Replace($solutionDir, "`$(SolutionDir)")
+$nativeAssembliesDir = Join-Path $path "NativeBinaries\*.*"
+
+$postBuildCmd = "
+xcopy /s /y `"$nativeAssembliesDir`" `"`$(TargetDir)`""
+
+#Remove
+try {
+    # Get the current Post Build Event cmd
+    $currentPostBuildCmd = $project.Properties.Item("PostBuildEvent").Value
+
+    # Remove our post build command from it (if it's there)
+    $project.Properties.Item("PostBuildEvent").Value = 
$currentPostBuildCmd.Replace($postBuildCmd, '')
+} catch {
+    # Accessing $project.Properties might throw
+}
\ No newline at end of file
Index: source/FirebirdSql/Data/Client/Native/FbClientFactory.cs
===================================================================
--- source/FirebirdSql/Data/Client/Native/FbClientFactory.cs    (revision 57499)
+++ source/FirebirdSql/Data/Client/Native/FbClientFactory.cs    (working copy)
@@ -58,7 +58,11 @@
                {
                        if (string.IsNullOrEmpty(dllName))
                        {
-                               dllName = DefaultDllName;
+                string architectureSpecificFile = 
Environment.ExpandEnvironmentVariables(@"%PROCESSOR_ARCHITECTURE%\fbembed.dll");
+                if (System.IO.File.Exists(architectureSpecificFile))
+                    dllName = architectureSpecificFile;
+                else
+                    dllName = DefaultDllName;
                        }
 
                        IFbClient fbClient;
Index: source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs
===================================================================
--- source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs        
(revision 57499)
+++ source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs        
(working copy)
@@ -397,7 +397,7 @@
                        this.options.Add("records affected", true);
                        this.options.Add("context connection", false);
                        this.options.Add("enlist", false);
-                       this.options.Add("client library", "fbembed");
+                       this.options.Add("client library", string.Empty);
                        this.options.Add("cache pages", 0);
                        this.options.Add("no db triggers", false);
                }
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to