如何使用 VS 安装项目(或根本!)部署 SharePoint BDC 模型包

发布于 2024-10-25 02:53:08 字数 1808 浏览 5 评论 0原文

背景:我们有一个 ClickOnce 部署的 WPF 应用程序,它与 WCF 服务通信,而 WCF 服务又与我们自己的 SQL 数据库通信,并通过客户端 OM 与 SharePoint 通信。为了设置 WCF 和 ClickOnce,我们有一个安装项目,它从安装用户那里获取有关服务器路径和数据库连接字符串的详细信息,并触发一个 Installer 类来执行一些有趣的操作,例如编写配置 XML 并为此更新 ClickOnce 捆绑器部署 URL 等。

我们需要通过此安装程序向 SharePoint 添加一些 BDC 模型,以便最终用户可以使用 SharePoint 列表界面来配置我们数据库中一些很少更改的表值。 (尽可能“一键”安装过程是客户强加的要求。)

在我们的 Visual Studio 2010 解决方案中包含 BDC 模型项目,我们可以获得 BDC 内容的打包 WSP,这听起来很棒。 .
然而,这样做的一个问题是,在打包到此 WSP 中的 feature.xml 中,会出现以下硬编码行:

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

Visual Studio won't build with the feature SiteUrl set to any other other than a SharePoint instance local to the machine (这是相当蹩脚的),所以我们无法改变 WSP 之前的情况。

此外,.bdcm 文件本身具有硬编码的连接字符串信息:

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

一旦安装用户提供了数据库连接信息,安装程序也必须重新编写该信息。

我也不确定通过 MSI 在服务器上实际安装 WSP 的最佳方法是什么(到目前为止我只想到尝试执行 powershell 脚本)。

在我看来,为第三方设计 BDC 模型不应该是一个晦涩难懂的场景,但我找不到任何关于如何克服这些问题的信息或支持!

有人有什么建议吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

眼眸 2024-11-01 02:53:08

我也遇到了这个问题。我想将我们的 BDC 模型打包到 WSP 中并通过 WSP 进行部署。不幸的是(正如您所指出的)BDC 模型包含必须针对每个环境进行配置的特定环境信息。

我们的目标是保留不同的 BDC 模型并仅导入它们,而不是将它们打包在 WSP 中。从它的声音来看,您可能需要在安装时询问特定的环境信息并以某种方式使用它。

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.

绿光 2024-11-01 02:53:08

您可以采用两种方法:

  1. 如果您使用“自定义”程序集类型(而不是 DotNetAssembly 作为 LobSystem 类型),
    您可以实施 IAdministrable 以允许您在 Central Admin 中更改属性(LobSystem 或 LobSystemInstance)。即使实现了 IAdministrable,它似乎也不适用于 DotNetAssemblies。

  2. 或者,您可以通过导入资源文件来更改属性。最简单的方法是导入模型,然后将其导出为资源文件,并编辑文件以更改您需要更改的属性。然后导入 bdcr(资源)文件,您将看到属性已更改的指示。

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.

对岸观火 2024-11-01 02:53:08

高级安装程序对此提供了一些支持。基本上,通过其 XML 编辑器,您可以使用 Windows Installer 属性,而不是清单文件中的硬编码值。

我能想到的另一个解决方案是使用 自定义操作,用于在安装后修改文件。

无论哪种方式,这都需要一个复杂的安装程序,例如 MSI 包。 ClickOnce 不支持它。

Advanced Installer offers some support for this. Basically, through its XML editor you can use Windows Installer properties instead of hard-coded values in your manifest files.

The other solution I can think of is to use a custom action to modify the files after install.

Either way, this requires a complex installer, like an MSI package. ClickOnce doesn't support it.

一腔孤↑勇 2024-11-01 02:53:08

如果您想在部署 BDC 时将其部署到特定的 siteURL,请在查看解决方案时转到 bcd 模型的项目文件夹,并且在该文件夹的属性中您应该会看到名为“功能属性”的内容。

单击省略号展开属性并添加一个名为“SiteUrl”的标题,并将其设置为您要部署的站点的根目录:即“http://spsite”。

它将部署到该站点而不是本地站点。

If you want to deploy your BDC to a specific siteURL when you deploy it, go to your project folder for your bcd model when you view your solution and in the properties of the folder you should see something called "Feature Properties".

Click on the elipsis to expand the properties and add a heading called "SiteUrl" and set it to be the root of the site you want to deploy it too: i.e "http://spsite".

It will be deployed to that site instead of the Local one.

匿名。 2024-11-01 02:53:08

在我们的例子中,我们使用位于 SharePoint 2010 的说明实现了自定义功能接收器,使用农场财产包具有动态站点网址
它允许在任何环境中部署,因为站点 URL 是在功能激活期间发现的。

In our case, we implemented a custom Feature Receiver using instructions located at SharePoint 2010, deploying a BCS Model using a farm property bag to have a dynamic siteurl
It allows to deploy in any environment because the Site Url is discovered during the feature activation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文