# Pubblicazione Data-Coupler: Guida 32-bit e 64-bit ## Perché è importante scegliere la piattaforma target Alcune tecnologie di connessione sono vincolate alla piattaforma (32-bit o 64-bit): | Tecnologia | Supporto | Note | |---|---|---| | **VFPOLEDB.1** (Visual FoxPro) | **Solo 32-bit** | Driver COM 32-bit, incompatibile con processi 64-bit | | **Microsoft.ACE.OLEDB.12.0** (Access 2010) | 32-bit o 64-bit (match) | Installa la versione corrispondente all'app | | **Microsoft.Jet.OLEDB.4.0** | **Solo 32-bit** | Driver legacy | | ODBC generico | Dipende dal driver | Usa Gestore ODBC a 64-bit per driver 64-bit | | SQL Server, MySQL, PostgreSQL, ecc. | 64-bit (consigliato) | Driver nativi .NET, nessun vincolo | --- ## Comandi di Pubblicazione ### 1. Pubblicazione Windows 64-bit (default, consigliato per SQL Server/MySQL/API REST) ```powershell dotnet publish Data_Coupler/Data_Coupler.csproj ` --configuration Release ` --runtime win-x64 ` --self-contained true ` --output ./publish/win-x64 ``` **Usa per**: SQL Server, MySQL, PostgreSQL, Oracle, REST API, ODBC 64-bit **Non usare per**: VFPOLEDB, Jet 4.0 --- ### 2. Pubblicazione Windows 32-bit (richiesta per Visual FoxPro / VFPOLEDB) ```powershell dotnet publish Data_Coupler/Data_Coupler.csproj ` --configuration Release ` --runtime win-x86 ` --self-contained true ` --output ./publish/win-x86 ``` **Usa per**: VFPOLEDB.1 (Visual FoxPro 8/9), Microsoft.Jet.OLEDB.4.0, driver OLE DB legacy 32-bit **Nota**: Il processo sarà 32-bit — massima RAM ≈ 4GB. --- ### 3. Pubblicazione Linux x64 ```powershell dotnet publish Data_Coupler/Data_Coupler.csproj ` --configuration Release ` --runtime linux-x64 ` --self-contained true ` --output ./publish/linux-x64 ``` **Attenzione**: OLE DB e ODBC (drivers Windows) **non sono supportati** su Linux. Su Linux sono disponibili solo: SQL Server, MySQL, PostgreSQL, Oracle, SQLite, DB2, SAP HANA, REST API. --- ### 4. Pubblicazione macOS (Intel) ```powershell dotnet publish Data_Coupler/Data_Coupler.csproj ` --configuration Release ` --runtime osx-x64 ` --self-contained true ` --output ./publish/osx-x64 ``` --- ### 5. Pubblicazione macOS (Apple Silicon - ARM64) ```powershell dotnet publish Data_Coupler/Data_Coupler.csproj ` --configuration Release ` --runtime osx-arm64 ` --self-contained true ` --output ./publish/osx-arm64 ``` --- ## Pubblicazione Framework-Dependent (senza runtime incluso) Se .NET 9 è già installato sul server target: ```powershell # Windows (framework-dependent, lascia a .NET la scelta della bitness) dotnet publish Data_Coupler/Data_Coupler.csproj ` --configuration Release ` --output ./publish/framework-dependent # Forzare 32-bit anche in framework-dependent (per VFP): # Compilare il progetto con PlatformTarget = x86 o usare --runtime win-x86 ``` --- ## Setup per Visual FoxPro (VFPOLEDB.1) ### Prerequisiti 1. **Driver VFPOLEDB installato** (32-bit): - Download: [Microsoft OLE DB Provider for Visual FoxPro 9.0 SP2](https://www.microsoft.com/en-us/download/details.aspx?id=14839) - Verifica installazione: `HKEY_CLASSES_ROOT\VFPOLEDB.1` deve esistere nel registro 2. **Applicazione pubblicata come 32-bit** (`--runtime win-x86`) 3. **Connection string esempio VFP**: ``` Provider=VFPOLEDB.1;Data Source=C:\VFP\Database\miodb.dbc;Collating Sequence=machine; ``` Per tabelle free (.dbf): ``` Provider=VFPOLEDB.1;Data Source=C:\VFP\Tabelle\;Collating Sequence=machine; ``` ### Verifica Rapida in PowerShell ```powershell # Verifica driver VFP installato Get-Item "HKCR:\VFPOLEDB.1" -ErrorAction SilentlyContinue # Verifica processo 32-bit in esecuzione [System.Environment]::Is64BitProcess # deve restituire False ``` --- ## Docker Per Docker con VFP (non consigliato — driver COM Windows-only): ```dockerfile # Nel Dockerfile, non è possibile usare VFPOLEDB su Linux container # Usare Windows Container (opzione Dockerfile.windows) ``` Per **Windows Container** con supporto 32-bit, modifica il `Dockerfile.windows`: ```dockerfile # Usa immagine Windows nano server FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 # Copia publish win-x86 COPY ./publish/win-x86 /app ``` --- ## Riepilogo Rapido | Scenario | Comando | |---|---| | Solo database SQL + REST API | `--runtime win-x64` | | Visual FoxPro / OLE DB legacy | `--runtime win-x86` | | Server Linux | `--runtime linux-x64` | | macOS Intel | `--runtime osx-x64` | | macOS Apple Silicon | `--runtime osx-arm64` |