SQL Visual Studio for SSRS 2008 - 如何在解决方案资源管理器中将报告组织到子文件夹中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3309002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 06:54:52  来源:igfitidea点击:

Visual Studio for SSRS 2008 - How to organize reports into subfolders in Solution Explorer?

sqlvisual-studiovisual-studio-2008reporting-servicesssrs-2008

提问by Greg

Right now I have a project called reports with several reports. In solution explorer it looks like this:

现在我有一个名为报告的项目,其中包含多个报告。在解决方案资源管理器中,它看起来像这样:

Shared Data Sources
 -- DEV
Reports
 -- Report1
 -- Report2
 -- Report3

I want to make it look like this and have the same structure carry over to the report manager website when I click deploy.

我想让它看起来像这样,并在单击部署时将相同的结构转移到报告管理器网站。

Shared Data Sources
 -- DEV
Folder A
 -- Report1
Folder B
 -- Report2
 -- Report3

Anyone know how to do this?

有人知道怎么做吗?

回答by

I'm using SSRS 2005 - I thinkthis part of it works in the same way as 2008.

我正在使用 SSRS 2005 - 我认为这部分的工作方式与 2008 年相同。

As far as I can tell, you can't have folders within projects, but you canhave multiple projects within a solution.

据我所知,项目中不能有文件夹,但一个解决方案中可以有多个项目。

To create a new folder, right-click on the solution in the Solution Explorer and select Add>New Project...

要创建新文件夹,请右键单击解决方案资源管理器中的解决方案,然后选择添加>新建项目...

Type in your new Project Name (eg. MyProject), and select Report Server Project from the list of Visual Studio installed templates. Click on OK, and your new Project should appear at the end of the list of projects in the Solution Explorer.

输入您的新项目名称(例如 MyProject),然后从 Visual Studio 安装的模板列表中选择报表服务器项目。单击 OK,您的新项目应出现在解决方案资源管理器中项目列表的末尾。

(There are other ways of setting up a new Reports project, but this seems to be the quickest.)

(还有其他方法可以设置新的 Reports 项目,但这似乎是最快的。)

If you now right-click on your new Report Project and select Properties, you can see the TargetReportFolder, which will default to your new Project Name (eg. MyProject). When you deploy reports from SSRS, they are deployed to this location. (You can change the location, if you wish - I find it easier to keep track of what's going where by using the Project name.)

如果您现在右键单击您的新报告项目并选择属性,您可以看到 TargetReportFolder,它将默认为您的新项目名称(例如 MyProject)。当您从 SSRS 部署报告时,它们将部署到此位置。(如果您愿意,您可以更改位置 - 我发现使用项目名称更容易跟踪正在发生的事情。)

You will need to copy any data sources to be used in each project, into the data sources folder of all projects that use that data source. By default, OverwriteDataSources is set to false, so when you deploy a new report, it will use the data source already deployed to the Report Manager environment.

您需要将要在每个项目中使用的任何数据源复制到使用该数据源的所有项目的数据源文件夹中。默认情况下,OverwriteDataSources 设置为 false,因此当您部署新报表时,它将使用已部署到报表管理器环境的数据源。

So to get the Report Manager structure that you want to see:

因此,要获得您想要查看的报告管理器结构:

  • Create Projects called Folder A and Folder B
  • Move/copy Report1 into the Reports folder in Project Folder A
  • Move/copy Report2 and Report3 into the Reports folder in Project Folder B
  • Move/copy data source DEV into the Shared Data Sources folders in Projects Folder A and Folder B
  • Deploy your reports
  • 创建名为文件夹 A 和文件夹 B 的项目
  • 将 Report1 移动/复制到项目文件夹 A 中的 Reports 文件夹中
  • 将 Report2 和 Report3 移动/复制到项目文件夹 B 中的 Reports 文件夹中
  • 将数据源 DEV 移动/复制到项目文件夹 A 和文件夹 B 中的共享数据源文件夹中
  • 部署您的报告

Don't forget to check your changes into source control.

不要忘记将更改签入源代码管理。

回答by Cody Konior

The way do it is similar to other posters, I have one solution with multiple projects (each project is named and put into the same folder name that I want it deployed under).

这样做的方式与其他海报类似,我有一个包含多个项目的解决方案(每个项目都被命名并放入我想要部署的相同文件夹名称中)。

Then I rigged up a script in RS which:
- Creates a single data source used by all reports, in my case
- Loops through all directories in the solution folder
-- Creates the same folder name on the RS server
-- Deploys all files in this directory to that folder on the RS server
-- Uses rs.SetItemDataSources on each report to redirect it to my main data source

然后我在 RS 中安装了一个脚本:
- 创建所有报告使用的单个数据源,在我的例子中
- 遍历解决方案文件夹中的所有目录
- 在 RS 服务器上创建相同的文件夹名称
- 部署所有文件这个目录到 RS 服务器上的那个文件夹
——在每个报告上使用 rs.SetItemDataSources 将它重定向到我的主数据源

And that's basically it.

基本上就是这样。

Caveats are you sometimes get files uploaded you didn't want to (like deleted reports with the .RDLs still hanging around). But you can script all around that, or just blow it away in RS and re-upload again.

需要注意的是,您有时会上传您不想上传的文件(例如已删除的报告,.RDL 仍然存在)。但是您可以围绕它编写脚本,或者只是在 RS 中将其删除并再次重新上传。

Doing this, I have one script but can deploy a structure under numerous different parent folders, each with different data sources, and have all the reports in a folder drawing data from a different database. This lets me run 1x RS instance but have development, testing, training, etc areas.

这样做,我有一个脚本,但可以在许多不同的父文件夹下部署一个结构,每个文件夹都有不同的数据源,并将所有报告放在一个文件夹中,绘制来自不同数据库的数据。这让我可以运行 1x RS 实例,但有开发、测试、培训等领域。

回答by ErikZ

We manage this with Linked Reports in SSRS. We deploy reports to a Report Distribution folder, hidden from users, then create Linked Reports in the Reporting Services web UI (an option in the Manage section for each report). You can create the Linked Report in any folder, so you can build the folder structure you want and put the linked reports in the appropriate place.

我们通过 SSRS 中的链接报告来管理这一点。我们将报表部署到对用户隐藏的报表分发文件夹中,然后在 Reporting Services Web UI(每个报表的“管理”部分中的一个选项)中创建链接报表。您可以在任何文件夹中创建链接报告,这样您就可以构建所需的文件夹结构并将链接报告放在适当的位置。

You can deploy everything to the single distrib folder from VS, and the linked reports are updated. This solves the sub-report and DataSource issues since all reports 'run from' the distrib folder. There's obviously a lot of setup up front, and creating a new environment is a hassle - It happens so infrequently that we haven't tried to automate it.

您可以将所有内容从 VS 部署到单个 distrib 文件夹,并更新链接的报告。这解决了子报告和数据源问题,因为所有报告都从 distrib 文件夹“运行”。显然有很多预先设置,创建一个新环境很麻烦——这种情况很少发生,我们还没有尝试过自动化。

回答by kkeilman

I have a BI project going in SSRS2008 with roughly 80 reports - and this is my experience with deploying reports into folders. This is my first foray into developing in Reporting Services, so any gurus please smack me if I'm out to lunch.

我在 SSRS2008 中有一个 BI 项目,其中包含大约 80 个报告 - 这是我将报告部署到文件夹中的经验。这是我第一次尝试在 Reporting Services 中进行开发,所以如果我出去吃午饭,任何大师都请打我。

Initially, I used folders in source control to separate smaller reports by department to help keep me organized. That worked fine while I was initially developing my reports, however the first time I deployed the project to the report server the structure was completely flattened - so I gave up on using a folder structure to organize.

最初,我在源代码管理中使用文件夹来按部门分隔较小的报告,以帮助我保持井井有条。这在我最初开发我的报告时工作得很好,但是当我第一次将项目部署到报告服务器时,结构完全扁平化 - 所以我放弃了使用文件夹结构来组织。

As far as I'm aware the only way you can create a folder structure in SSRS is to use the Report Manager UI and create folders on the Report Server. I'm assuming from there you would modify the path in the report properties in Visual Studio. Either that or you have to define the path when you first set up the report. I haven't tested this so YMMV.

据我所知,您可以在 SSRS 中创建文件夹结构的唯一方法是使用报表管理器 UI 并在报表服务器上创建文件夹。我假设您将从那里修改 Visual Studio 中报告属性中的路径。或者您必须在首次设置报告时定义路径。我还没有测试过这个所以YMMV。

So in conclusion: It is not possible to create the folders in BIDS and deploy your reports into folders utilizing the IDE. I hope this is addressed in 2008R2 because it's kind of a pain having all those reports thrown together in the Solution Explorer.

所以总而言之:不可能在 BIDS 中创建文件夹并将您的报告部署到使用 IDE 的文件夹中。我希望在 2008R2 中解决这个问题,因为将所有这些报告放在解决方案资源管理器中是一种痛苦。

回答by Rez.Net

You can have the files in separate folders on the disk/source control however they list flat and sorted alphabetically in Visual Studio.

您可以将文件放在磁盘/源代码管理上的单独文件夹中,但是它们在 Visual Studio 中按字母顺序排列。

I cannot see a user interface to manage the above thing but if you edit the project file (single project file of a VS solution) you can specify the FullPath XML tag of each report file.

我看不到管理上述内容的用户界面,但是如果您编辑项目文件(VS 解决方案的单个项目文件),您可以指定每个报告文件的 FullPath XML 标记。

回答by skiwii

I created a report server type project and had no option to add another project. Instead I edited the SLN file and added my other projects. The first part of the SLN file then looked like this in the end to access my 2 projects in sub folders to the SLN file

我创建了一个报表服务器类型的项目,但无法添加另一个项目。相反,我编辑了 SLN 文件并添加了我的其他项目。SLN 文件的第一部分最终看起来像这样,以访问我在子文件夹中的 2 个项目到 SLN 文件

Microsoft Visual Studio Solution File, Format Version 10.00

Microsoft Visual Studio 解决方案文件,格式版本 10.00

Visual Studio 2008

视觉工作室 2008

Project("{F14B399A-7131-4C87-9E4B-1186C45EF12D}") = "RestOfWorld", "RestOfWorld\RestOfWorld.rptproj", "{D24D5EEA-88A4-4375-802B-7CA877202787}" EndProject

项目(“{F14B399A-7131-4C87-9E4B-1186C45EF12D}”)=“RestOfWorld”,“RestOfWorld\RestOfWorld.rptproj”,“{D24D5EEA-88A4-4375-802B-72CA7877”End

Project("{F14B399A-7131-4C87-9E4B-1186C45EF12D}") = "NorthAmerica", "NorthAmerica\NorthAmerica.rptproj", "{C64A3BDC-F526-4037-AD48-31799BECC3AD}" EndProject Global

Project("{F14B399A-7131-4C87-9E4B-1186C45EF12D}") = "NorthAmerica", "NorthAmerica\NorthAmerica.rptproj", "{C64A3BDC-F526-4037-AD48-31799BE EndProject

回答by BobHy

@skiwii is correct, with VS 2013 Community edition and SQL Data Tools -- Business Intelligence, you do notsee the Solution node at the top of the tree in VS Solution Explorer, and you do have to hack the .SLN file to expose it.

@skiwii是正确的,在VS 2013社区版和SQL数据工具-商业智能,你就没有看到解决方案节点在VS解决方案资源管理树的顶部,你必须破解.sln文件揭露它.

  1. Start with the desired master .sln and one .rptproj file in your source tree. call that 'parent'.
  2. Create a brand new, empty Report Services .rptproj file in a new subfolder (under the folder containing the .sln). e.g, project is 'child1'. VS will also give you a child1.sln file in that folder.
  3. Close all VS windows.
  4. With your favorite text editor (teco!)
    1. open child1.sln.
    2. Copy the 2 lines at the top; Project... and EndProject
    3. Open parent1.sln
    4. Paste those lines under the existing Project / EndProject.
  5. Now open parent1.sln in VS. You will magically see the Solution node at the top of Solution Explorer window.
  1. 从源代码树中所需的主 .sln 和一个 .rptproj 文件开始。称其为“父母”。
  2. 在新的子文件夹(包含 .sln 的文件夹下)中创建一个全新的空 Report Services .rptproj 文件。例如,项目是“child1”。VS 还会在该文件夹中为您提供一个 child1.sln 文件。
  3. 关闭所有 VS 窗口。
  4. 使用您最喜欢的文本编辑器(teco!)
    1. 打开 child1.sln。
    2. 复制顶部的 2 行;项目...和结束项目
    3. 打开 parent1.sln
    4. 将这些行粘贴到现有的 Project / EndProject 下。
  5. 现在在 VS 中打开 parent1.sln。您将神奇地在解决方案资源管理器窗口的顶部看到解决方案节点。

If you have been very lucky, you will also see a second project called child1. But if not, no problem. You can just right click on the solution and Add a new project of type Report Services.

如果你很幸运,你还会看到第二个名为 child1 的项目。但如果没有,没问题。您只需右键单击解决方案并添加类型为 Report Services 的新项目。