使用TeamCity部署SSRS 2008 R2报告项目(Using TeamCity to deploy SSRS 2008 R2 Reporting Projects)

编程入门 行业动态 更新时间:2024-10-25 23:28:22
使用TeamCity部署SSRS 2008 R2报告项目(Using TeamCity to deploy SSRS 2008 R2 Reporting Projects)

我们希望将我们的SSRS 2008 R2项目整合到我们的自动构建流程中。 目前TeamCity每周三次构建并部署我们的C#代码库。 我们希望将SSRS报告项目添加到该项目中。 RDL文件当前位于Subversion源代码控制库中。

We are looking to integrate our SSRS 2008 R2 projects into our automated build process. Currently three times a week TeamCity builds and deploys our C# codebase. We'd like to add the SSRS report projects to that. The RDL files are currently in a Subversion source control repository.

最满意答案

您可以将Report Server Web服务用于此目的。 它具有CreateItem方法,可将报告上载到 Reporting Service。

要创建上传rdl文件的C#项目,您需要为您的ReportService2010.asmx端点创建代理类 ,然后使用它是这样的:

ReportingService2010 reportingService = new ReportingService2010();
reportingService.Url = url + "/ReportService2010.asmx";
reportingService.Credentials = new System.Net.NetworkCredential(username, password, domain);
Microsoft.SqlServer.ReportingServices2010.Warning[] warnings = null;            

using (FileStream reportStream = new FileStream("c:\\report.rdl", 
       FileMode.Open, FileAccess.Read))
{
    using (MemoryStream ms = new MemoryStream())
    {
        reportStream.CopyTo(ms);
        CatalogItem report = reportingService.CreateCatalogItem(
            "Report",
            "Report1",
            "/",
            true,
            ms.ToArray(),
            null,
            out warnings);
     }
}

You can use Report Server Web Service for this purpose. It has CreateItem method that uploads report to Reporting Service.

To created C# project that uploads rdl files you will need to create proxy class for your ReportService2010.asmx endpoint and then use is it like this:

ReportingService2010 reportingService = new ReportingService2010();
reportingService.Url = url + "/ReportService2010.asmx";
reportingService.Credentials = new System.Net.NetworkCredential(username, password, domain);
Microsoft.SqlServer.ReportingServices2010.Warning[] warnings = null;            

using (FileStream reportStream = new FileStream("c:\\report.rdl", 
       FileMode.Open, FileAccess.Read))
{
    using (MemoryStream ms = new MemoryStream())
    {
        reportStream.CopyTo(ms);
        CatalogItem report = reportingService.CreateCatalogItem(
            "Report",
            "Report1",
            "/",
            true,
            ms.ToArray(),
            null,
            out warnings);
     }
}

                    
                     
          

更多推荐

本文发布于:2023-07-31 00:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340385.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报告   项目   TeamCity   SSRS   Reporting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!