问题
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:
- Updating Visual Studio and SSDT;
Copying MyDeploymentContributor.dll and MyDeploymentContributor.pdb to the following locations:
C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\Extensions
C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions
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
- Core Services: SafeDirectoryCatalog: Assembly
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!
回答1:
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.
来源:https://stackoverflow.com/questions/34520446/sql-server-data-tools-error-loading-custom-deploymentplanmodifier-required-con