BDC Visual Studio Project and Missing Assembly Trouble
September 13, 2013
I just had a strange error the other day, deploying Business Connectivity Services (BCS) model arranged around a NET assembly. When accessing the external list data, I found the following error:
Assembly was requested for LobSystem with Name 'Namespace.LobSystem', but this assembly was not returned. SystemUtility of Type 'Microsoft.SharePoint.BusinessData.SystemSpecific.DotNetAssembly.DotNetAssemblySystemUtility' requires the assembly to be uploaded.
Of course, I checked the assembly and it was loaded in the GAC. So, where's the error coming from?
Well, our friend BCS registers the assemblies for your external content type when you activate the feature containing your BCS Model and Assembly. This feature is made automatically when you create a new BCS project in Visual Studio. The feature has a custom feature receiver and also has a custom entry in the feature.xml declaration.
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key="IncrementalUpdate" Value="false" />
<Property Key="ModelFileName" Value="YourModelYourModel.bdcm" />
**<Property Key="BdcModel1" Value="BdcAssembliesYourAssembly.dll" />**
</Properties>
It has to match the name of the LOB System in the BDCM file (the entity model):
<LobSystem Name="**LobSystemName**" Type="DotNetAssembly">
<LobSystemInstances>
<LobSystemInstance Name="LobSystemInstance" />
</LobSystemInstances>
My error was renaming the model in some point of time. It went well for the model XML, but the old name ("BdcModel1") was still remaining in the feature.xml. After manually editing the feature.xml and pointing it to the new name of the LOB System, the error was gone:
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key="IncrementalUpdate" Value="false" />
<Property Key="ModelFileName" Value="YourModelYourModel.bdcm" />
<Property Key="**LobSystemName**" Value="BdcAssembliesYourAssembly.dll" />
</Properties>