我使用Visual Studio数据工具2015创建了一个报告项目。当我使用报告向导创建报告.rdl文件时,rdl文件的模式为2016年。我的报告服务器版本是12.0.4213.0。如何创建与我的报告服务器兼容的报告.rdl文件?我尝试通过右键单击项目->属性并将TargetServerVersion更改为"Sql server 2008 R2、2012或2014"来更改,但这也不起作用。
TargetServerVersion
属性的报告特定版本将在BIN(\debug或您构建的任何其他位置)文件夹中创建。我也在试图找到相同的答案。你会认为简单地设置解决方案的TargetServerVersion就会导致它使用正确的报告定义(或者他们可以选择给你添加一个pre-2016报告项的选项)
在那之前,如果您右键单击.rdl并查看代码,则可以更改以下行以使其在SQL 2014中工作-只需备份原始.rdl以防犯错误:
1)用以下内容替换报告xmlns行:
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
2) 移除 ReportSections 和 ReportSection 行,保留它下面的子树结构 body 标签等内容。因此,请移除以下内容:
<ReportSections>
<ReportSection>
而这些是我们所拥有的最重要的财富。
</ReportSection>
</ReportSections>
3) 删除整个ReportParametersLayout部分。因此(例如),删除此部分:
<ReportParametersLayout>
<GridLayoutDefinition>
<NumberOfColumns>4</NumberOfColumns>
<NumberOfRows>2</NumberOfRows>
</GridLayoutDefinition>
</ReportParametersLayout>
点击保存,返回设计页面并运行报表。如果您没有修改设计,则可以在SQL2014中正常工作。但是一旦您更改了任何字段,它就会恢复到2016架构。
如果有人发现解决此问题的方法,请告诉我们。谢谢!
TargetServerVersion
设置为所需的格式(在本例中为SQL Server 2008 R2、2012或2014
)。Build => OutputPath
),找到所需格式的rdl文件。$file = (Get-Content "InputFileNameHere.rdl")
# Unwraps the Body and the Page element.
# Simple string replacement
$file = $file -replace '<ReportSections>',""
$file = $file -replace '<ReportSection>',""
$file = $file -replace '</ReportSection>',""
$file = $file -replace '</ReportSections>',""
# Parse the XML doc
$xml = [xml]$file;
# Set the XML namespace
$xml.Report.xmlns = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition";
# Delete ReportParametersLayout node
$xml.Report.RemoveChild($xml.Report.ReportParametersLayout);
# Save the file
Set-Content -Value $xml.OuterXml -Path "OutputFilenameHere.rdl"
将第一行编辑以匹配您的输入文件和最后一行,将其保存为something.ps,运行并上传新文件。
$path = "$PSScriptRoot\Invoice.rdlc"
$file = (Get-Content $path)
- robbpriestley尝试这个链接中的步骤,对我有效:
Error while uploading a report将报告代码中含有2016的第二行替换为以下内容:
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
ReportParametersLayout
部分并将其删除。点击减号显示一行,右键剪切。