CreateDeploymentUtility option into SSIS 2012 packages - sql

I use SSIS 2012 and want to set the value True to CreateDeploymentUtility option. The package contain an Execute SQL Task that insert a value into a sql table.
I search for this Option in : Solution Explorer -> Properties -> Deployment Utilities but i don't found it. There I have only 'Server Name' and 'Server Project Path' options.
How can I set True for CreateDeploymentUtility option?
Please help me!!
Thanks!!!

There are two different deployment models available to you with the 2012 release of SSIS. The new model, called project deployment model, treats all of your SSIS packages as class files that get "compiled" into a .ispac file, much as .net files get turned into an assembly. This .ispac file then gets deployed into the database into a dedicated catalog, SSISDB. Very cool stuff and by default when you create a project in SSIS 2012, this is the model it will use.
The second deployment model, the classic one familiar to SSIS developers from 2005 on is called the package deployment model. Right click on the SSIS project and you will have an option for converting from project deployment to package deployment.
Note that there are incompatible features between the two. Project level Connection Managers are only available in the Project Deployment Model and the last time I tried to convert a project from package to project deployment model, it switched the configuration to package and project parameters.

Related

VSTS build doesn't pickup the dacpac file (hosted agent in cloud)

I'm trying to use VSTS to deploy into my database, the problem is in one of the steps I need to pick up the dacpac file and deploy it to the Azure SQL server but it fails:
in that step, I'm using "Execute Azure SQL: DacpacTask" which is provided by Microsoft in VSTS.
there is a filed to do it which is called "DACPAC File" and the documentation said to use it like this:
$(agent.releaseDirectory)\AdventureWorksLT.dacpac
but it gave me the below error:
No files were found to deploy with search pattern
d:\a\1\s\$(agent.releaseDirectory)\AdventureWorksLT.dacpac
so I did a cheating and put the below value in it:
d:\a\1\s\AdventureWorksLT.dacpac
it does work but obviously, it won't work forever as I need to use an environment variable, something like :
$(agent.releaseDirectory)\AdventureWorksLT.dacpac
any suggestion?
I've had this same problem. I wasn't able to find detailed documentation, but from experimenting, this is what I found.
I'm assuming that your DACPAC is created as part of a Build Solution task. After the build completes and the DACPAC is created, it exists in a sub-folder of the $(System.DefaultWorkingDirectory) directory.
Apparently, the Azure SQL Database Deployment task cannot access the $(System.DefaultWorkingDirectory) folder. So the file must be copied somewhere where it can be accessed. So here's what I did:
The Visual Studio Build task builds the solution, including the DACPAC. The resulting DACPAC is placed in a $(System.DefaultWorkingDirectory) sub-folder.
Add a Copy Files task as your next step. The Source Folder property should be "$(System.DefaultWorkingDirectory)". The Contents property should be "**/YourDacPacFilename.dacpac". The Target folder should be $(build.artifactstagingdirectory). The "**/" tells VSTS to search all subfolders for matching file(s).
Add an Azure SQL Database Deployment task to deploy the actual DACPAC. The DACPAC file will be in the $(build.artifactstagingdirectory).
I had the same problem and I solved it by removing the old artifact from the release and adding it again to take the correct alias of the new artifact.
That's why the Azure SQL Database Deployment task says it doesn't have access to the $(System.DefaultWorkingDirectory) folder, the artifact has changed and you must make sure you're using the new one that is saved in the azure pipeline.

Post deployment parameters in DacPac

I'm creating a DacPac in TeamCity by building a sql project. The resulting DacPac has a post deployment script that I would like to update either on deployment or before it is created with a version number. Is it possible to set this parameter either in TeamCity or on deployment of the DacPac?
The sqlpackage.exe command line looks like
C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" /Action:Publish /Sourcefile:#{SourceFolder} /TargetDatabaseName:DBName /TargetServerName:#{SqlServer}
Where "#{}" is a parameter on octopus deploy server. The post deployment script in the SQL Project looks like :
declare #version varchar(10)
set #version = 'z'
IF EXISTS (SELECT * FROM tVersion)
UPDATE VersionTable SET Version = #version
ELSE
INSERT INTO VersionTable VALUES (#version)
The way I have been doing it is by using file content replacer on teamcity to replace 'z' with a version number but this method is not ideal. This could lead to errors in the future if another dev were to check in the the file with a different parameter that didn't fit the regular expression used in the file content replacer build feature.
You have a couple of different approaches you can take, the first one is the easiest in that you define a SqlCmd variable in your .sqlproj (properties of the project, SQLCMD variables tab) and reference that it your post deploy script. When you deploy you can override the variable by using /v:variable_name= (If you aren't using sqlpackage.exe to deploy, what are you using? Octopus deploy?).
The second way is harder but is pretty straight forward, the dacpac can be read from and written to using the .net packaging api, there is a stream (file) called postdeploy.sql (open it as a zip file and it is obvious which one is the post deploy file), you can read it, change your specific value and then write it back again.
For more manual editing of a dacpac see:
https://github.com/GoEddie/Dacpac-References
Ed

SQL Server : DacPac drops everything when another SSDT project is referenced

we have the following SSDT project structure:
DBCore project: includes all objects that are not sql server edition exclusive.
DBStandardEdition project: includes all standard edition specific objects.
The DBStandardedition project references the DBCore project with the "same database" option.
When I publish the DBStandardEdition project to my demo server via visual studio directly, everything works. All the standard edition related objects are created correctly.
When I compare the database on the demo server to my dacpac file with the schema comparison tool in visual studio, the tool wants to drop all objects I have defined within DBStandardEdition project. We also have a program that publishes the dacpac files with the DacServices - Class (DacServices.Deploy). This program actually drops everything defined in my DBStandardEdition.dacpac file.
Am I doing something wrong here or is it a bug?
Update
I figured out a problem in my project settings. I have set the "Build output file name" for all databaseprojects to the same value. After I changed this, Visual Studio generates two DacPac - Files in my DBStandardEdition\Bin\Release Folder. DBCore.dacpac And DBStandardEdition.dacpac. When I now use the compare tool of visual studio to compare the DBStandardEdition.dacpac to my Database (and enable the "Include composite objects (database target only)" - option), all looks good. Newly added objects to DBCore project are listed with "Add", all my objects in my DBStandardEdition projects are still there. When I activate the Deployoption "Include composite objects..." everything deploy fine.
You need to enable the "Include composite objects (database target only)" option in the Schema Compare Options. This is off by default and means that the referenced objects are being excluded from the comparison.

Making SSDT just generate a SQL script (and not deploy a database)

Having recently upgraded to SSDT 2012 I seem to be missing the option to just generate a T-SQL script instead of deploying the database to a server somewhere.
To be more accurate the predecessor to SSDT used to set the Deploy action to 'Generate script', but I cannot locate that option anywhere in the new version.
Is it possible?
To generate a script from an offline data project in SSDT rather than deploy to a target database, configure the project settings as shown below
You may want to look at the SQLPackage command line. You can set the options there to use an action of "script" and specify an outputfile name to generate scripts instead of publishing the database. You can also do that through a batch file so it will generate a script every time. You still need to provide a source project and target database, though. The reference for SQLPackage can be found here: http://msdn.microsoft.com/en-us/library/hh550080%28v=VS.103%29.aspx
Yes, it is possible.
Is you select Build > Publish ProjectName... from the menu bar, a dialog window pops-up with publishing options – there's a Generate Script button at the bottom of the dialog window.
I also had a problem where the SSDT project would attempt to deploy changes when the project was run.
In the project properties, choose the "Debug" tab. Change the Start Action to "None". That will prevent it from trying to deploy at that time.

SSIS Deployment Utility - specifying different folders in MSDB

I am deploying my SSIS packages to MSDB by configuring the deployment utility and creating the manifest file in Visual Studio (2005).
In the Integration Services, I created a new folder to segregate my packages. Is there a way to specify this folder for my packages when creating the deployment utility?
If not, how do I move packages into the new folder once they're installed?
Thank you
I don't think it's possible to change the target folder in the deployment utility, as it can be used for both MSDB and file system deployments. It would be something you specified in the deployment wizard after selecting a SQL Server deployment - but the option isn't presented.
Once deployed, you can move packages around using the dtutil.exe utility, using the /move subcommand
dtutil /Sources *serverName* /SQL *packageName* /move SQL;*folderName\packageName*
As you can also use it to copy packages between the file system and MSDB storage, DTutil offers an alternative method of deploying files in the first place.