Pergunta

I have created a BDC model and deploy it through a feature. The feature has to have a SiteUrl as specified in the feature xml below. However when I move the feature from say the development to test, acceptance or production environment, then the SiteUrl will cause a conflict and the WSP package will fail to install.

Now this is not very handy since I have to either repackage every time I move environment or fiddle with URLs / Alternate Access Mappings in the environments. My question is are there any handy approaches to this problem? So far the only approach I could think of is a custom build script. Surely there must be something handier...

<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Description="This feature installs the BDC Models for the Business Connectivity Service" Id="83af2a77-02f5-4391-8bf5-917addc8029d" ReceiverAssembly="Microsoft.Office.SharePoint.ClientExtensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.SharePoint.ClientExtensions.Deployment.ImportModelReceiver" Scope="Farm" Title="Foobar.SharePoint.BCS BDC Models">
  <Properties>
    <Property Key="SiteUrl" Value="http://sparked-dev:9999" />
    <Property Key="IncrementalUpdate" Value="true" />
    <Property Key="ModelFileName" Value="SmartAppBDCModel\SmartAppBDCModel.bdcm" />
    <Property Key="SmartAppBDCModel" Value="BdcAssemblies\Foobar.SharePoint.BCS.dll" />
  </Properties>
  <ElementManifests>
    <ElementFile Location="SmartAppBDCModel\SmartAppBDCModel.bdcm" />
    <ElementFile Location="BdcAssemblies\Foobar.SharePoint.BCS.dll" />
  </ElementManifests>
</Feature>
Foi útil?

Solução

Apparently this is a bug. A possible solution is to use http://localhost/ as the URL, but I think this may still get overwritten by VS when you next open the project. In that case a custom build action may be the way to go for the time being.

Outras dicas

I also stubled over that problem and found the answer in this post: http://www.silver-it.com/node/92.

It mainly proposes the following:

  • Remove the association to the event receiver from the model (property "Feature Reeiver" of the BDC project)
  • Edit the existing feature that deploys the BDC Model, Add an event receiver to it
  • Create a new class that derives from ImportModelReceiver (lets call it CustomBdcDeployment)
  • In FeatureActivated of your feature set the property (of the instance of SPFeatureReceiverProperties you get passed in the method FeatureActivated) SiteUrl to the value you need (get it from wherever you want). Create an instance of your custom class craeted above (CustomBdcDeployment) and pass the modified instance of SPFeatureReceiverProperties to its FeatureActivated method.
  • In the FeatureDeactivating do pretty much the same as on FeatureActivated. Set the property SiteUrl to the value you need and pass the properties to FeatureDeactivating of a new instance of CustomBdcDeployment.

that's it.

If you are looking for updating BDC connector DLL programatically through code then please check this link : -

http://blog.techperspect.com/2013/12/how-to-update-bdc-bcs-custom-connector.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top