Using SqlPackage.exe on a server without SSMS inst

2019-07-23 16:00发布

I have a windows 2012 server. The server can access my SQL database. I don't have access to the SQL database server, and I don't have access to install SSMS on the windows 2012 server running my website.

I want to use SqlPackage.exe to update my database scheme with a .dacpac file

I get the following error:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Dac.DacPackage' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Dac.DacServices' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SqlSchemaModelStaticState' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.TransactSql.ScriptDom, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

Is there some way that I can give SqlPackage.exe the needed Microsoft.SqlServer.TransactSql.ScriptDom without installing SSMS on the server?

If it is not possible, is there then an exsisting stand-alone exe out there that can do the job?

4条回答
聊天终结者
2楼-- · 2019-07-23 16:45

You can download any of these nuget packages (depending on desired version and platform). There you will find any missing DLLs.
https://www.nuget.org/packages?q=microsoft.sqlserver.dac+microsoft.sqlserver.dacfx

(Or you could write your own C#/Powershell application, using Microsoft.SqlServer.Dac.DacServices directly from the package.)

查看更多
Summer. ? 凉城
3楼-- · 2019-07-23 16:45

This seemed to be the "smallest" package I could install and still get the tool (sqlpackage.exe) that works.

Microsoft® SQL Server® Data-Tier Application Framework (June 30 2016)

https://www.microsoft.com/en-us/download/confirmation.aspx?id=53013

the above installed it to the below directory when I install it (today)

C:\Program Files\Microsoft SQL Server\130\DAC\bin\SqlPackage.exe

查看更多
The star\"
4楼-- · 2019-07-23 16:49

Usually you install SSDT to do this. I'm not sure if theres a portable version of SSDT somewhere that doesn't require an install if thats what you actually require.

查看更多
▲ chillily
5楼-- · 2019-07-23 16:52

SqlPackage come with SMSS or SQL Data Tools.

i see no other alternative than installing one of these two binaries to deploy dacpac, it is also possible from most computer running visual studio, because sql data tools is part of the defaults VS install.

https://msdn.microsoft.com/en-us/library/mt204009.aspx

查看更多
登录 后发表回答