I cannot find any references to how to package a deployment contributor in a dacpac.
So my question is how does one specify these deployment contributors in the dacpac?
I tried putting the deployment contributor class in the SSDT project in Visual Studio, but that interferes with the CLR assemblies loaded into SQL Server (i.e., it gets loaded into SQL Server and if its dependencies are not also set to be loaded, an error is thrown).
Please advise. Thank-you.
To put into the dacpac that you want a specific contributor loaded then you need to manually edit the .sqlproj file and add this:
<PropertyGroup>
<DeploymentContributors>$(DeploymentContributors);AgileSqlClub.DeploymentPlanLogger</DeploymentContributors>
</PropertyGroup>
AFTER
<Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
Change "AgileSqlClub.DeploymentPlanLogger"
to whatever your contributor exports its name as (i.e. [ExportDeploymentPlanModifier("AgileSqlClub.DeploymentPlanLogger", "0.1.0.0")]
)
Adding this xml will cause your "Origin.xml" in your dacpac to have this:
<RequiredContributors>
<DeploymentContributor Name="AgileSqlClub.DeploymentPlanLogger" Version="0.1.0.0" />
</RequiredContributors>
You are probably one of the only people who ever uses this feature so who knows if it works?? Let everyone know!
You will also need to deploy the contributor to the machine you are building your dacpac on and the machine you deploy or generate the deploy script from. On the machine you will deploy from:
The path that the dacfx looks to find deployment contributors is hard-coded to:
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Microsoft SQL Server\120\DAC\bin\Extensions")
So on my system it is "c:\program files(x86)\Microsoft SQL Server\120\DAC\bin\Extensions".
On the machine you will use when you compile the dacpac you need it in the visual studio path that is in the link:
http://agilesqlclub.codeplex.com/wikipage?title=Deploying&referringTitle=Documentation
See the section "If you publish in SSDT":
(on my system with vs 2015 it is C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions)
One other thing is that when you copy your contributor to the extensions directories you can put them inside another folder so you can keep your extensions and whatever dependencies that has separate from any other contributors which will have its own set of dependencies (and dll hell dies with .net lol)
Out of interest what does your contributor do?
If it is OSS please consider sharing it:
https://github.com/DacFxDeploymentContributors/Contributors
Ed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With