visual-studio-2010sharepoint-2010setup-projectbdcbcs

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?


Solution

  • 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.