Using SqlPackage.exe on a server without SSMS installed - c#

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?

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

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

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

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

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.

Related

SSIS Deployment to Azure SQL Server, System.Net.Http.Formatting could not be found

I'm working on a project to setup a Visual Studio SSIS API package to deploy to our Azure SQL Server. It's supposed to grab data from TalentAPI and store it in our Sql Server tables through a SSIS to be executed by our SQL Server on a schedule.
This project was built with target SQL Server being 2019. Then I had to change it to SQL Server 2017 to allow it to work on Microsoft SQL Azure.
SSIS project was deployed using SSIS in SQL Server from Visual Studio 2019.
A script component source is used to make the call to TalentAPI to retrieve the data.
There is an error associated with a SSIS script component, about the System.Net.Http.Formatting could not be found when executing the package in Azure SQL Server. That so far, I've been unable to resolve.
Current Error:
Load Users data from TalentLMS to Onshore SQL DB:Error: System.IO.FileNotFoundException: Could not load file or assembly
'System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The system cannot find the file specified.
File name: 'System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)
Specs:
Visual Studio 2019,
SSIS Project target SQL Server 2017 currently,
System.Net.Http.Formatting 5.2.9.0,
Microsoft SQL Azure (RTM) - 12.0.2000.8 Oct 18 2022 13:24:45
Since the Microsoft SQL Azure (RTM) - 12.0.2000.8 is rented on an instance, I'm unable to determine which version of .NET is needed to match up.
Any thoughts?
Tried so far:
Clearing out the NuGet cache, clean solution, restoring Nuget packages, and build.
Setting the System.Net.Http.Formatting Copy Local attribute to True to try to copy the System.Net.Http.Formatting to SQL server when deployed.

SQL database not connecting to Visual Studio 2015

I have downloaded and installed Visual Studio 2015 Community (because it is being used in college professional version) and SQL Server 2016 Service Pack 3 with SQL Server Management Studio 18.
I have been trying to connect or create a new database connection and it is showing me the attached error
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
I have tried multiple solutions here and it took me a whole day and it's still not fixed.
I have downloaded all SQL Server features from feature pack found from here: https://www.microsoft.com/en-us/download/details.aspx?id=103444
Installed packages via nupkg still no success.
Also, I checked the C:/Program Data/assembly and it contained the Microsoft.SqlServer.Management.Sdk.Sfc version 13.0.0.0
while it gives the error of 12.0.0.0.
I need help!
PS: I had previously installed 2019 version but uninstalled it and all of it's components (I think all) is it the issue? if that is recommend something to solve this issue, I have a project to show on Monday.
Please try download and install Microsoft SQL Server System CLR Types and Microsoft SQL Server 2014 Shared Management Objects from :
https://www.microsoft.com/en-US/download/details.aspx?id=42295
In addition, which version of your Windows? If you are using Windows 10, SQL Server 2012 requires service pack 2 to make it compatible with Windows 10. Please download and install from below link.
http://www.microsoft.com/en-us/download/details.aspx?id=43351

Execute package from SSIS catalog programmatically in SQL Server 2014

Does anybody know if Microsoft.SqlServer.Management.IntegrationServices can still be used to manage remote execution of SSIS packages in SQL Server 2014? Remotely running a project-deployed SQL 2012 SSIS Package suggests that this worked in SQL Server 2012.
MSDN page Running and Managing Packages Programmatically also lists the above mentioned namespace for working with packages (although it doesn't state if it works with remote packages).
My packages are stored in the SSISDB catalog which need to be triggered from a web application running on a different server. When I run the program in my dev environment with SSIS installed locally everything works okay but in production I am getting the following error:
Exception type: FileNotFoundException Exception message: Could not
load file or assembly
'Microsoft.SqlServer.Management.IntegrationServicesEnum,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or
one of its dependencies. The system cannot find the file specified.
As this dll is not referenced by my project, I am wondering if the production server requires SSIS or components of installed in order to work correctly.
I have referenced the following libraries in my project:
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.Management.IntegrationServices.dll
I was never able to figure an answer out to my original question so I ditched the API and went with stored procedures instead, using catalog.start_execution.

System.Data.SqlServerCe.dll SQL Server CE 3.5 reference missing after generating .exe file using InstallShield Limited Edition Project

I am using VS 2013 with InstallShield Limited Edition Project.
Everything is working fine in development environment where I have created reference to System.Data.SqlServerCe.dll
After I generate .exe file and install my application it is unable to find reference for SQL Server CE 3.5 thus automatically gets reference for SQL Server CE 4.0 and gave an error.
Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = \?\C:\Users\someuser\AppData\Local\testapp\testdb.sdf ]
I have tried going through "this" article on MSDN but I can't find any publish tab in properties of my project.
Furthermore I am deploying System.Data.SqlServerCe.dll and all 7 32bit version SQL Server CE 3.5 dlls with my setup.
sqlceca30.dll
sqlcecompact30.dll
sqlceer30en.dll
sqlceme30.dll
sqlceoledb30.dll
sqlceqp30.dll
sqlcese30.dll
No, the issue is that your database file is in 4.0 format. As you can see from the error message, the engine is trying to open a 3,5 file, but gets a 4,0 file instead. So your application is using the 3,5 engine.
The problem was when I was trying to deploy msi package using InstallShield it used different build setting(x64) than my current setting(x86) which was causing my application to get the reference of x64 Sql Server CE 4.0 files.
So it was fixed by changing setting of singleimage compiling option.

A native exception occurred in .Net EXE

I have developed a C#.net windows form application to get and update data from /to a SQL server CE database.While I'm running this app on windows ce 6.0 machine, getting following error:
A native exception occurred in ItemDB.exe(my exe name).
Details:
Exception code : 0x80000002
Exception address: 0x40e843b4
Faulting module: sqlceme35.dll
offset: 0x000043b4
at
NavigateMethod.GetKeyInfo(parm1,parm2,...)
at
SqlCEDataReader.FillMetaData(command)
at
sqlCeCommand.InitializeDataReader()
So I searched in net and found this link:
http://go4answers.webhost4life.com/Example/cant-find-pinvoke-dll-sqlceme35dll-49162.aspx
http://blogs.msdn.com/b/sqlservercompact/archive/2007/10/26/can-t-find-p-invoke-dll-sqlcemenn-dll.aspx
As suggested, I copied ZIP file(because, I didn't get Cab files) and changed this to .Cab.Then I tried to run Cab,But, its saying "this is not a valid wince setup file".
Hope I explained it clearly.Could anyone please help me?
This is almost always caused by a SQL CE version difference between what you compiled against on the PC and what you have deployed on the device. Make sure that the SQL CE version number is identical in both your project references and what is on the device. Typically I add the reference not from the ".NET" tab in references, but I specifically brows to the reference so I know exactly which file is being used, and then manually deploy SQLCE from the same location to the device.
*EDIT
The location you should be looking for the files to deploy is here:
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i
And your project reference should point here:
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\System.Data.SqlServerCe.dll

Categories

Resources