Deploy a VS Business Data Connectivity Model Solution in SharePoint

What to do in SharePoint after you try to deploy a VS BDCM model solution and get an error message that begins: Error1 Error occurred in deployment step 'Add Solution'.

+1
Stefan Kowalewski, Ethan Wilanskyand 1 more

March 12, 2012

1 Min Read
Deploy a VS Business Data Connectivity Model Solution in SharePoint


Q: How do I deploy a Visual Studio Business Data Connectivity Model (BDCM) solution in SharePoint after changing the identity?

Problem: You’re developing a Business Data Connectivity Model (BDCM) solution in Visual Studio and need to change the identifier for an entity. When you deploy the model, you get the following error message, even after deleting the External Content Types and BDC Model from Central Administration:

Error 1 Error occurred in deployment step 'Add Solution': Model file 'ModelContacts.bdcm' has the following External Content Type activation errors:
TypeDescriptor with Name 'Email' (found in Parameter with Name 'contact', Method with Name 'ReadItem', Entity (External Content Type) with Name 'Contact' and Version '1.0.0.1' in Namespace 'SharePoint.BdcModel.ContactsModel') refers to an Identifier with Name 'Email' of Type 'System.String' which is supposed to exist on Entity with Name 'Contact' in Namespace 'SharePoint.BdcModel.ContactsModel'. This Identifier cannot be found.

Solution: During the deployment the solution gets retracted, deleted, re-added and deployed. However, because the identity has been changed, the deployment fails during the add solution step because the type descriptor for the original identifier can’t be found. The reference to the original identifier exists in the feature, which still exists.

To successfully redeploy the solution, first delete the External Content Types and BDC Models. From the SharePoint 2010 Management Shell type the following:
 

$modelFile = Get-SPBusinessDataCatalogMetadataObject -Name ContactsModel -BdcObjectType Model -ServiceContext http://contosoRemove-SPBusinessDataCatalogModel -Identity $model


Next, disable and remove the feature. The GUID you’ll use will be different than the example below. You can use Get-SPFeature to get the identity for your solution. (NOTE: the feature may already be disabled.)

Disable-SPFeature -Identity 8b9b0eff-4fbb-4908-8f37-a47cb898309f -ForceUninstall-SPFeature -Identity 8b9b0eff-4fbb-4908-8f37-a47cb898309f -Force

Finally, uninstall and remove the solution:

Uninstall-SPSolution -Identity contactsmodel.wspRemove-SPSolution -Identity contactsmodel.wsp


You will now be able to successfully deploy your solution.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like