2

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?

Squazz
  • 3,912
  • 7
  • 38
  • 62
  • 1
    What you should be looking for if you ever have this sort of question is a "redistributable" version of the tool. [This blog post](http://sqlblog.com/blogs/jamie_thomson/archive/2012/05/30/redistribution-of-sqlpackage-exe-ssdt.aspx) discusses redistribution of SqlPackage. There may be other ways to force it to "work" without going down the redistributable route but it wouldn't be officially licensed use. – Damien_The_Unbeliever Dec 01 '16 at 14:48
  • The server exists to stop people like you from using backdoors to the server. Without more context, this is a bad question since you should be talking to your local DBA/ server sysadmin – clifton_h Dec 01 '16 at 18:23

5 Answers5

1

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

freakydinde
  • 1,070
  • 1
  • 9
  • 10
  • I'm not trying to run it from a server with VS installed. In that case I would have SSDT to do the job :) – Squazz Dec 01 '16 at 14:51
1

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.)

MEMark
  • 1,493
  • 2
  • 22
  • 32
1

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

APPEND:

Mid 2020 URL Update :

Microsoft® SQL Server® Data-Tier Application Framework (18.3.1)

https://www.microsoft.com/en-us/download/details.aspx?id=100297

granadaCoder
  • 26,328
  • 10
  • 113
  • 146
1

Since Aug 2018 your best bet is to download the "Windows .NET Core .zip file" from https://learn.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-2017#get-sqlpackage-net-core-for-windows

CrazyPyro
  • 3,257
  • 3
  • 30
  • 39
0

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.

gmn
  • 4,199
  • 4
  • 24
  • 46
  • I tried installing SSDT on the server, but that didn't change anything :/ It still complains about missing the file – Squazz Dec 01 '16 at 14:51
  • You have to reference sqlpackage from inside the ssdt installation @Squazz – gmn Dec 01 '16 at 14:52
  • something like: \Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\... – gmn Dec 01 '16 at 14:54
  • Referencing it from the SSDT installation it still fails. I don't have the \130\SDK dir. I have a \120 containing \DAC. That's it :) – Squazz Dec 01 '16 at 14:57
  • Could be an old version of SSDT installed, I went through this process yesterday. – gmn Dec 01 '16 at 14:59
  • I might have found a way to make a "portable" version, but when I try to execute it on a Windows sever I get an "Access is denied" error, and I get a UAC popup that tells me that "This app can't run on your PC" :/ I'm running CMD as an admin – Squazz Dec 01 '16 at 15:16