Find Sqlpackage.exe on client machine to install DACPAC - c#

I'm developing a .Net-application that would deploy a dacpac on a client machine. For that purpose I would require SqlPackage.exe to deploy the dacpac.
I need a absolute path of SqlPackage.exe to make my application work irrespective of client's machine configuration.
Can you please help me to achieve this.
Thanks,
Yogesh

You can install sqlpackage.exe in two ways:
SSDT (SQL Server Data Tools): the location will be VS Install Directory\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\{SqlVersion}, VS install directory: C:\Program Files (x86)\Microsoft Visual Studio {VsVersion}.0
SQL Server Management Studio (SSMS) and the Dac Framework MSI: C:\Program Files (x86)\Microsoft SQL Server\{SqlVersion}\Dac\bin
SqlVersion is 140 for the SQL Server 2017, 130 for the SQL Server 2016 etc.
VsVersion is 14 for Visual Studio 2017
More details in this question.

To find sqlpackage programmatically you can make use of the TaskModuleSqlUtility powershell library. Either run the Invoke-DacpacDeployment from the powershell script (sorry not C#) or make use of Get-SqlPackageOnTargetMachine function for sqlpackage.exe path.
Search for tests in github for samples.

you also can download from microsoft doc site
https://learn.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-ver15&viewFallbackFrom=sql-server-ver17
and check your version of sql and get correct instructions

Related

How can i solve specified module could not be found Error in Asp.NET?

I am using Microsoft Visual Studio 2010 and create ASP.NET MVC 2 Web Application.
Here i add SQL Server database after that i want to create new table that time "The Specified module could not found" error was come. I don't know how to solve that.
Please help me. Thanks in advance.
This seems to be due to an update, someone has wrote this:
The problem seems to be with the Visual Database Tools DLL.
This DLL file is installed by the VS 2010 installation, but during a
SQL Server 2012 installation, it will be upgraded to the SQL 2012
version of the tools. Thereafter, uninstalling and reinstalling SQL or
VS will not remove this newer DLL in order to allow the older version
to be installed, and hence leave this annoying issue.
How I fixed it was I set up a clean virtual machine and installed VS
2010, then took this original DLL from my virtual machine and
overwrote the DLL on my live machine. Simple as that.
I would assume though that deleting this DLL file and then doing a VS
2010 repair or uninstall/reinstall would also fix the problem.
The directory and file name of the DLL (on an X64 machine) is:
C:\Program Files (x86)\Common Files\microsoft shared\Visual Database
Tools\dsref80.dll
See the entire thread for more information
Please refer below url this will help you:
You have to uninstall visual studio and then you have to install it.
http://seesharpaspdotnet.blogspot.in/2013/02/the-specified-module-could-not-be-found.html
I found this at
http://social.msdn.microsoft.com/Forums/vstudio/en-US/6793785a-ec98-4453-a62b-f1a85195ec05/unable-to-load-dll-hresult-0x8007007e?forum=csharpgeneral
" Try to copy the SQLBOOT.DLL from your SQL serverInstallation kit and Paste to the
following location "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn"
Seems the SQLBOOT.DLL is missed or corrupted do the aboce steps as I mentioned and try to start it. "
Hope it helps

c# namespaces for SQL management, used for sql server backup

I am trying to pragmatically run a backup of an SQL Server database using C# .NET 3.5/4.0. I have found out how to accomplish this, however I can't seem to find the namespace libraries that are used for the backup.
I am looking for the Microsoft.SqlServer.Management libraries, I just can't find these anywhere. I have installed SQL Server 2005 Enterprise and all of the tools samples and the libraries still don't seem to appear in visual studio (version 2010)
Any input is appreciated, thanks.
You will find them under:
"C:\Program Files (x86)\Microsoft SQL
Server\100\SDK\Assemblies"
(Thats on my 64-bit machine for SQL 2008.)
You need all three of the following assemblies:
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.SqlEnum.dll
Microsoft.SqlServer.SmoEnum.dll
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo(v=SQL.90).aspx
The Assemblies for SMO and the like exist under C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies (adjust for appropriate bitness of your machine and SQL Server version - I think 2005 would be \90\ rather than \100\

How to incorporate the SQL Server Express installer in my own setup?

I want to publish an application which has these requirements:
.NET Framework
SQL Server 2005 Express
I'm using the 'Setup Project' in Visual Studio 2008. I have added my project files and it has successfully detected the .NET Framework dependency.
The problem is:
I want to include all the files (.NET Framework and SQL Server Express setup files) with the installer.
I want the installer to first check and see if the required files are installed on the target computer.
I want to add SQL Server Express installer to the dependencies so that the installer sets up .NET Framework and SQL Server Express automatically on the target computer if needed.
Check out this one: Include another MSI file in my setup project

Installing SQL Server and .NET Framework from a visual studio setup project

I have to do four things install .net framework 3.5 ,install SQL Server 2005 and run my sql script on the server and create the database and install my application how to do it in a single setup project using visual studio 2005/2008
Use NSIS instead of the Visual Studio installer project:
http://nsis.sourceforge.net/Main_Page
It's much more powerful, but still pretty straightforward to use. Also there's lots of sample code for common tasks like installing .NET or SQL Server.
You can't install SQL Server from a Visual Studio setup project.
You'll probably have to write an installer yourself or get an installer that you can attach other installers to it. Not sure why you would want to install sqlserver on a client's machine. Why not go with SQLLite or something that can be installed easily and have your database deployed without running scripts.
The framework can't be installed from within an MSI setup project. you can specify that it is a prerequisite but can only hope that the use will go through with the installation. If you are running a simple application you might get away with embedding the framework basic files in to your installation package.
Then comes SQL2005. If you can settle with SQL2005 express then the proper DLLs will be added to your project and no installation needs to be done. If you do need a standard edition then you can execute the SQL installation with predefined flags.
Creating a database is a little more tricky as the user should specify the database location and have the SQL server have privileges on that folder. I would strongly recommend NOT to create the database & run the scripts in the setup project but do it as a wizard the first time the program is executed.
The more you add up to the setup project the harder it will be to roll-back everything if something goes wrong in the installation.
Gilad.
this article can also be helpfull for installing sql server
http://www.csharpnedir.com/articles/read/?id=1032&filter=unedited&title=SETUP%20PROJES%C4%B0%20%C4%B0%C3%87ER%C4%B0S%C4%B0NDE%20SQL%20SERVER%20KURMAK

SQL CE unspecified error

I did a project with MS SQL Server CE that when installed in the 'costumer' machine just raises an unspecified excpetion.
Did some research and looks like I did everything mentioned. The dev env has sql compact 3.5 installed and sql tools for vs 2005. Using dotNet 3.5. But to make it run in de dev machine I need to add the sqlcese30, sqlceqp30, sqlceme and sqlcecompact30 dlls and its works fine.
The setup project put dotNet 2.0 as dependecy and I also added the dlls but it raises the exception and I cannot see where or what it is. Its just a single 'unspecified error' message.
please help :)
Have you tried using the SQL CE re-distributable installer on the customer machine?
You can add SQL CE 3.5 as a pre-requisite to the setup project. If it is not already in the list, copy the SQL Server Compact Edition directory from C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages to C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages and restart Visual Studio 2005.

Categories