Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy SharePoint BDC model package using VS setup project (or at all!)

Background: We have a ClickOnce-deployed WPF app, that talks to WCF Services, which in turn both talk to our own SQL database and also to SharePoint via the Client OM. To set up the WCF and the ClickOnce, we have a Setup project, which takes in details about server paths and database connection strings from the installing user and fires an Installer class to do fun stuff like writing config XML and updating the ClickOnce strapper for that deployment URL and such.

We need to add some BDC Models to SharePoint via this installer, so that end users can use SharePoint list interfaces to configure some of the rarely-changed table values in our database. (As "one-click" an install process as possible is a requirement being imposed by the client.)

Including a BDC Model project in our Visual Studio 2010 solution, we can get a packaged WSP for our BDC stuff, which sounds great...
One problem with this, however, is that in the feature.xml that gets packaged into this WSP, this hard-coded line appears:

<Property Key="SiteUrl" 
    Value="http://BuildingWorkstationSharePointInstanceUrl/" />

Visual Studio won't build with the feature SiteUrl set to anything other than a SharePoint instance local to the machine (which is pretty lame), so we can't change that pre-WSP.

Furthermore, the .bdcm files themselves have hard-coded connection string information:

<LobSystemInstance Name="DatabaseName">
  <Properties>
    <Property Name="AuthenticationMode" Type="System.String">PassThrough</Property>
    <Property Name="DatabaseAccessProvider" Type="System.String">SqlServer</Property>
    <Property Name="RdbConnection Data Source" Type="System.String">DatabaseServer</Property>
    <Property Name="RdbConnection Initial Catalog" Type="System.String">DatabaseName</Property>
    <Property Name="RdbConnection Integrated Security" Type="System.String">SSPI</Property>
    <Property Name="RdbConnection Pooling" Type="System.String">True</Property>
    <Property Name="ShowInSearchUI" Type="System.String" />
  </Properties>
</LobSystemInstance>

This would also have to be re-written by the installer once the installing user has provided the database connection information.

I'm also not sure what the best approach will be for actually installing the WSP on the server via the MSI (trying to execute a powershell script is all I've thought of so far).

It seems to me like designing BDC models for a third party shouldn't be that obscure of a scenario, but I can't find any information or support on how to overcome any of these problems!

Anyone have any advice?

like image 272
Grank Avatar asked Nov 29 '25 15:11

Grank


2 Answers

I ran into this issue as well. I'd like to package our BDC model into a WSP and deploy it via the WSP. Unfortunately (like you've indicated) the BDC model contains specific environment information that must be configured per environment.

What we've landed on is keeping the different BDC models and just importing them instead of packaging them in a WSP. From the sounds of it, you may need to ask for the specific environment information at the time of install and somehow use that.

like image 178
Doug Stalter Avatar answered Dec 02 '25 05:12

Doug Stalter


Two methods you could employ:

  1. If you're using a "Custom" assembly type (instead of a DotNetAssembly as your LobSystem Type), you can implement IAdministrable to allow you to change properties (either the LobSystem or LobSystemInstance) in the Central Admin. It doesn't seem to work for DotNetAssemblies, even if IAdministrable is implemented.

  2. Alternatively, you can change properties by importing Resource Files. Easiest way to do this is to import your model, then export it as a Resource file and edit the file down to the properties you need changed. Then import the bdcr (resource) file and you'll see an indication that the properties had been changed.

like image 42
svanschalkwyk Avatar answered Dec 02 '25 04:12

svanschalkwyk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!