This week, I attempted to import a bacpac file on my development machine using SQLPackage for Windows, but I encountered an error while reading the bacpac file. The error message stated: “File contains damaged data.
Resolution:
- Download SQLPackage .NET Core software in your Development Machine.
- To extract the file by right-clicking on the file in Windows Explorer, and selecting ‘Extract All…’, and select the target directory.
- Open a new Terminal window and cd to the location where SqlPackage was extracted:
Note Note: If you still getting an error, download the lower version of SQLPackage.exe from here.
Command to import bacpac
SqlPackage.exe /a:import /sf:”Database bacppac file” /tsn:localhost /tdn:AxDB /p:CommandTimeout=1200 /TargetTrustServerCertificate:True
Example:
SqlPackage.exe /a:import /sf:”C:\Temp\Testbackup.bacpac” /tsn:localhost /tdn:AxDB_New /p:CommandTimeout=1200 /TargetTrustServerCertificate:True