SQL Server Data Tools: Error loading custom DeploymentPlanModifier: Required contributor with id could not be loaded
Asked Answered
O

1

13

I need to intercept an SSDT build to modify the build script. I've followed the MSDN Deployment Plan Modifier tutorial, but when I attempt to build the database project, I get the following error:

Required contributor with id 'MyDeploymentContributor.SqlRestartableScriptContributor'
could not be loaded.

I am using Visual Studio 2012 (Version 11.0.61219.00 Update 5) and SSDT Version 11.1.50730.0.

I signed the assembly but did not specify a password.

I've followed several solutions I've found online to no avail, including the following:

  1. Updating Visual Studio and SSDT;
  2. Copying MyDeploymentContributor.dll and MyDeploymentContributor.pdb to the following locations:

    1. C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\Extensions
    2. C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin
    3. C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120
    4. C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions
  3. Capturing an event log for SSDT and DacFx (following Kevin Cunnane's instructions at https://social.msdn.microsoft.com/Forums/en-US/5c84ab8e-b50b-4ecd-86da-866ac3bb2248/known-issue-with-ssdt-extensibility-in-current-release?forum=ssdt). Here are the results from the DacFx log:

    • Core Services: SafeDirectoryCatalog: Assembly C:\Program Files (x86)\Microsoft Visual Stusio 11.0\Common7\IDE\Extensions\Micrsoft\SQLDB\DAC\120\Extensions\MyDeploymentContributor.dll added
    • Core Services: Extension Lookup: directory C:\Program Files (x86)\Microsoft Visual Stusio 11.0\Common7\IDE\Extensions\Micrsoft\SQLDB\DAC\120\Extensions added to extension lookup path
    • Core Services: FilteringCompositionContainer: Looking up exports for Microsoft.SqlServer.Dac.Deployment.DeploymentPlanExecutor
    • Core Services: FilteringCompositionContainer: Changed part creation policy to NonShared
    • Core Services: FilteringCompositionContainer: Looking up exports for Microsoft.SqlServer.Dac.Deployment.DeploymentPlanModifier

There were no ContributorLoader messages. From this log, the contributor seems to be loading correctly. The SSDT log didn't contain any events that mentioned the contributor.

There are no required contributor arguments, so the DeploymentContributor node in my .sqlproj file looks like this:

<PropertyGroup>
    <DeploymentContributors>
        $(DeploymentContributors); MyDeploymentContributor.SqlRestartableScriptContributor
    </DeploymentContributors>
</PropertyGroup>

Any help is appreciated. Thanks!

Organography answered 29/12, 2015 at 23:2 Comment(3)
Can you post the export of your contributor method (OnExecute?) please also grab a sample from github.com/DacFxDeploymentContributors/Contributors and see if that works? The logging one is a good one to see if everything is setup correctlyIncontrollable
My OnExecute method is copied from https://msdn.microsoft.com/en-us/library/ee461507(v=vs.100).aspx and looks like this: http://pastebin.com/CYYv8ZsE. I tried using the contributors from the github link you provided, and got the same error (and the same DacFx log entries) as before.Organography
Palladian, I am facing the exact same issue (in my case ,it's VS 2013). Were you able to find a solution to this issue. Also, do we need to copy MyRefKey.snk along with the dll to the extensions folder?Overanxious
O
5

Thanks to Ed Elliot ( https://the.agilesql.club/Blogs/Ed-Elliott/About ), I was able to resolve this issue in my case.

I followed Ed's suggestions and it worked. I created a folder like C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions\[YourContributorName]\ and copied all the contents (including DLLs) from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120 to there.

In the contributor project, I referenced the DLLs inside C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions\[YourContributorName]\

Once the project was built successfully, I copied the contributor .dll and .pdb files to the following location:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions\[YourContributorName]\

Before, I was referencing the DLLs from C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin.

Hope this would help someone.

Overanxious answered 5/5, 2016 at 15:58 Comment(2)
I really love when tools like this always tell you there's something wrong and never tell you what is wrong and how can you fix it.Coincidentally
To add a bit to this: If you are using the DacFx nuget package (or assemblies) to programmatically publish, the assembly needs to be in a subdirectory of your current directory named `Extensions\[YourContributorName]`Exhilaration

© 2022 - 2024 — McMap. All rights reserved.