microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
313 stars 19 forks source link

*** The SourceFile argument must refer to a file with a '.bacpac' extension. #428

Closed jackliusr closed 6 months ago

jackliusr commented 6 months ago

Steps to Reproduce:

  1. use sqlpackage to install a .dacpac file.

Did this occur in prior versions? If not - which version(s) did it work in? It is my first time to use it in this environment.

dzsquared commented 6 months ago

Hi @jackliusr - can you share an example of the command you're trying to run with SqlPackage?

There's 2 pairs of commands:

  1. import/export for bacpac files
  2. publish/extract for dacpac files

If you have a dacpac file - you want to use publish to apply that dacpac to a new or existing database.

jackliusr commented 6 months ago

I use "publish" command now. however, I got the following error: I use " /TargetConnectionString:"Server=:::,1433;....". I tried "Server=localhost,1433;" ,"Server=localhost,1433;" etc. All the connection strings work in azure data studio in wsl.

*** A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught) *** A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)

llali commented 6 months ago

@jackliusr the error above happens when commenting to the server fails. You can verify you connection string using SSMS before calling a publish command. The error "The SourceFile argument must refer to a file with a '.bacpac' extension" only happens if calling sqlpackag with /a:import parameter.

jackliusr commented 6 months ago

@llali , you are right. I used publish command after @dzsquared replied. However, I got connection string issue. The connection string is definitely right, as I used it for as connection string in another parts which work.

For the connection issue, it might not be relevant to this issue considering the issue about file name.

Should I close this issue?