MrFox MrFox - 1 year ago 215
PowerShell Question

'AdditionalDeploymentContributors' is not a valid argument for the 'Publish' action

I have a set of views of which only 1 needs to be deployed, a different one in each deployment. Filtering DacPac deployments should do it. I'm aware the out of the box options have improved, but that won't do for my needs.

The database is published through SqlPackage it explicitly lists these parameters as valid for the publish action. Yet when I use these, it produces the errors (in red):

*** 'AdditionalDeploymentContributors' is not a valid argument for the 'Publish' action.
*** 'AdditionalDeploymentContributorArguments' is not a valid argument for the 'Publish' action.

I use the following command in a Deploy.ps1 file:

& $sqlpackageFileName /a:Publish /sf:$DacPacFileName /tcs:$ConnectionString /v:RefToOtherDatabase="${OtherDatabaseName}" /pr:$OptionsFromPublishFile /p:AdditionalDeploymentContributors="AgileSqlClub.DeploymentFilterContributor" /p:AdditionalDeploymentContributorArguments=$NordicsDeployFilter

It may be that I'm already getting options from my publishing profile. But if I put them in my PropertyGroup, publishing produces the error:
Contributor initialization error
. Can't get any more details.

  1. Why can't it load the AdditionalDeploymentContributor

Thanks for your reply, just to keep the question complete, adding what's in my comment.

I'm using SQL Server 2012, which I think is version 110. In my folder structure:
Microsoft SQL Server/110/DAC/bin
I cannot find the .dll you refer to. It is in
Microsoft SQL Server/120/DAC/bin
and I don't have a never version installed so
Microsoft SQL Server/130/DAC/bin
contains very little, no DAC folder.

  1. Where should I be adding these .dlls?

When I try to change the config file it produces the error
Please check if this file is opened in another program.
. I've tried stopping SQL Server windows services, thought they might have it in use. Process Explorer can't find the file as in use and Openfiles can't find any open files. Even though I have the file open in Notepad++, so I'm unclear on what that does then.

  1. What must I do to edit the config file?

Note: I'm using Visual Studio 2013 and SQL Server 2012. With SSDT tools for Visual Studio 2013.

Answer Source

I suspect you're getting that Contributor initialization error because you're using Ed's contributor with the latest version of SqlPackage.exe. The deployment contributor was built targeting an earlier version of the DACFx API and we've updated some version numbers. You can work around this by adding a binding redirect to the SqlPackage.exe.config file. Here are instructions from Jack Yang on the MSDN SSDT forum (

To run against version 130, please modify the SqlPackage.exe.config to add the binding redirect on the Microsoft.SqlServer.Dac.dll and Microsoft.SqlServer.Dac.Extensions.dll. This file can be found right next to SqlPackage.exe.

Example shown in below,

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" /> <bindingRedirect oldVersion="" newVersion="" /> <bindingRedirect oldVersion="" newVersion="" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.SqlServer.TransactSql.ScriptDom" publicKeyToken="89845dcd8080cc91" culture="neutral" /> <bindingRedirect oldVersion="" newVersion="" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.SqlServer.Dac" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="" newVersion="" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.SqlServer.Dac.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="" newVersion="" /> </dependentAssembly> </assemblyBinding> </runtime>

We started shipping AppLocal version of Microsoft.SqlServer.TransactSql.ScriptDom with DacFx in July; therefore, depending on which version of DacFx you have, if you didn’t see the Microsoft.SqlServer.TransactSql.ScriptDom.dll in the same folder with DacFx, then you don’t need the binding redirect for it. It should be in the GAC already.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download