Using BCS Meta Man and SharePoint Foundation 2010

Please note, this article is only relevant if you use SharePoint Foundation 2010.

If you use SharePoint Server 2010 then you’ll have no problems with deploying BCS Models and .Net Assembly Connectors generated by BCS Meta Man – it is simply a case of press F5 for it to package and deploy automatically. If you are using SharePoint Foundation 2010 there are a few extra steps you need to take. You’ll need to write an extra Feature Event Receiver which will deploy the generated Model to the SharePoint Foundation. To do this please follow the steps below

1) Follow the “BCS Meta Man – Getting started” article to create a new external content type using BCS Meta Man. If you try to deploy this to SharePoint Foundation you’ll see the following error.

   image

2) Open up your Solution Explorer and right click on the feature and add a new event receiver.

    image

 

 

3) Thankfully Microsoft have produced a sample event receiver that will do the job for us. Download the code from here – Event Receiver

4) Open up your feature receiver class, and replace the body of that class with the code you downloaded in step 3. Please make sure you have added the new namespaces as well.

5) Now we need to add new references to the project! To do that, first we need to copy the Microsoft.BusinessData.dll from GAC to the ISAPI folder. Go to Start->Run and type there C:Windowsassemblygac_msil. There you can find Microsoft.BusinessData folder, in which is located Microsoft.BusinessData.dll. Copy and paste this assembly to C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14ISAPI.

6) Go back to the project and add the following two references to the project.

  • System.Web, Version=2.0.0.0 , which is on the .Net tab.
  • Microsoft.BusinessData.dll,  which can be found in the C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14ISAPI folder – so you need to use the Browse tab.

7) Click on the BCSMetaMan folder in the solution explorer and update two properties related to the Feature Receiver – Assembly Name and Class Name.

  • Assembly should be $SharePoint.Project.AssemblyFullName$
  • Class name should be the full type name of your event receiver class(Namespace + class name). In this scenario it is FoundationTest.Features.Feature1.Feature1EventReceiver  

    image

8) Double click on the feature in the Features folder and view the properties. Make sure the Receiver class name is set properly, it should be the same that we have set in step 7.

    image

Now you are ready to deploy your BCS Model to SharePoint Foundation and use the external content types.

Leave a comment