SSRS 报告定义比服务器更新
SSRS report definition is newer than Server
我在 Visual Studio 2015 年创建了一些报告,其中包含所有最新更新。但是,当我尝试部署报告时,我收到此消息:
The definition of this report is not valid or supported by this version of Reporting Services.
11:40:28 Error
The report definition may have been created with a later version of Reporting Services, or contain content that is not
11:40:28 Error
well-formed or not valid based on Reporting Services schemas. Details: The report definition has an invalid target
11:40:28 Error
namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.
.rdl 文件的第一行是这样设置的:
<?xml version="1.0" encoding="utf-8"?>
<Report MustUnderstand="df"
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition"
xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
我可以更改架构定义吗?如果是这样,为了什么?我尝试将 2016 年更改为 2014 年或 2012 年,但均无效。
有什么地方可以查看有效定义吗?
我实际上 运行 遇到了类似的问题,我需要进行更改导致 2016 年出现 "Undocumented Error/Invalid RDL Structure" 错误,因此我编辑了 RDL 文件以便可以在早期版本中打开它并做出我的改变。不太难,但您需要进行一些标签编辑。
对于新报告,您可能应该只使用旧版本,但对于现有报告,您可以这样做:(我恢复到 2008)
- 更改报告标签:
- 删除 MustUnderstand="df"
- 将 xmlns 值更改为“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition”
- 删除 xmlns:df 属性。
- 删除整个 "ReportParametersLayout" 块。
- 删除 "df" 标签及其内容。
- 删除 "ReportSections" 和 "ReportSection" 开始和结束标签(不是内容)。
实际上写了一些 superhackish 代码来作为博客的一部分来做到这一点 post,但是手动编辑很简单。
我 运行 遇到了同样的问题,我就是这样解决的,
- 将报表项目属性中的 "TargetServerVersion" 属性 设置为旧版本的报表服务器。
- 构建项目。
- 获取 bin 文件夹中的报告并部署到旧报告服务器。
您的源报告格式和命名空间将更新到最新版本。但是 bin 文件夹报告将构建为与目标报告服务器版本兼容。
下面的设置应该设置为你的特定版本的 SSRS,然后从 \bin 目录中获取 RDL
或者,在更新 TargetServerVersion 后,只需使用 rdl 中的 right click | deploy
。
接受的答案比 difficult/prone 到 error/unlikely 多得多,可以跨多个版本的 ssrs 工作,并且每次更改 rdl 时都需要应用。
我最近 运行 也关注这个问题。我发现我只需要更改有问题的 .rdl 文件中的两项。
更改自:
报告 xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
收件人:
举报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"
与其他回复不同,我需要 2010 而不是 2008。我会检查您已经部署的 .rdl 文件。
- 删除 "ReportParametersLayout" 块。
注意:如果我删除了 ReportSections 块,它不会像其他人所说的那样工作。
我已将此任务自动化。
创建一个带有名为 "TextBoxFile" 的文本框和一个按钮的表单。
在点击按钮的代码中:
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(TextBoxFile.Text)
Dim root = xmlDoc.DocumentElement
For Each elel As XmlNode In root.ChildNodes
Debug.WriteLine(elel.Name & " " & elel.NodeType)
Next
If root.Attributes()("xmlns").Value <> "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" Then
root.Attributes()("xmlns").Value = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
End If
Dim nsmgr = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("bk", "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition")
Dim autoRefreshElements = root.GetElementsByTagName("AutoRefresh")
While autoRefreshElements.Count > 0
root.RemoveChild(autoRefreshElements(0))
End While
Dim ReportParametersLayout = root.GetElementsByTagName("ReportParametersLayout")
While ReportParametersLayout.Count > 0
root.RemoveChild(ReportParametersLayout(0))
End While
Dim ReportSections = root.GetElementsByTagName("ReportSections")
If ReportSections.Count > 0 Then
' Move content of ReportSections just below the block.
Dim ReportSection = ReportSections(0).ChildNodes()
' First, copy the elements after
Dim precedent = ReportSections(0)
For Each child As XmlNode In ReportSection(0).ChildNodes
Dim clone = child.Clone
root.InsertAfter(clone, precedent)
precedent = clone
Next
' After deleting the existing block
While ReportSections.Count > 0
root.RemoveChild(ReportSections(0))
End While
End If
xmlDoc.Save(TextBoxFile.Text)
MsgBox("Ok")
我在切换到 VS2017 并安装 Report Designer 版本 14.2 时遇到了同样的问题。
对我来说,只需 3 个步骤即可解决问题。
1:将 xmlns
设置为“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition”
2:删除 ReportSections
" 和 "ReportSection
"(仅限标签)。
3: 删除报告 ReportParametersLayout
部分。
你唯一需要记住的就是将xmlns指向2008/01
换成2008/01后尝试运行报告,错误信息中可以看到另外2个步骤
如果您在使用 LocalReport (RDLC) 的 Visual Studio 2017 C# 桌面应用程序中遇到问题,请查看此答案:
最简单直接的解决方案。我建议你在当前项目的 Manage NuGet Packages 中找到 Microsoft.ReportingServices.ReportViewerControl.WebForms 并将此 dll 版本更新到最新版本。
从 VS 菜单导航:工具 > NuGet 包管理器 > 管理解决方案的 NuGet 包
通过本地管理员帐户登录并通过删除和创建这些计算机对象来更正这些计算机对象。
我在 Visual Studio 2015 年创建了一些报告,其中包含所有最新更新。但是,当我尝试部署报告时,我收到此消息:
The definition of this report is not valid or supported by this version of Reporting Services.
11:40:28 Error
The report definition may have been created with a later version of Reporting Services, or contain content that is not
11:40:28 Error
well-formed or not valid based on Reporting Services schemas. Details: The report definition has an invalid target
11:40:28 Error
namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.
.rdl 文件的第一行是这样设置的:
<?xml version="1.0" encoding="utf-8"?>
<Report MustUnderstand="df"
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition"
xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
我可以更改架构定义吗?如果是这样,为了什么?我尝试将 2016 年更改为 2014 年或 2012 年,但均无效。
有什么地方可以查看有效定义吗?
我实际上 运行 遇到了类似的问题,我需要进行更改导致 2016 年出现 "Undocumented Error/Invalid RDL Structure" 错误,因此我编辑了 RDL 文件以便可以在早期版本中打开它并做出我的改变。不太难,但您需要进行一些标签编辑。
对于新报告,您可能应该只使用旧版本,但对于现有报告,您可以这样做:(我恢复到 2008)
- 更改报告标签:
- 删除 MustUnderstand="df"
- 将 xmlns 值更改为“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition”
- 删除 xmlns:df 属性。
- 删除整个 "ReportParametersLayout" 块。
- 删除 "df" 标签及其内容。
- 删除 "ReportSections" 和 "ReportSection" 开始和结束标签(不是内容)。
实际上写了一些 superhackish 代码来作为博客的一部分来做到这一点 post,但是手动编辑很简单。
我 运行 遇到了同样的问题,我就是这样解决的,
- 将报表项目属性中的 "TargetServerVersion" 属性 设置为旧版本的报表服务器。
- 构建项目。
- 获取 bin 文件夹中的报告并部署到旧报告服务器。
您的源报告格式和命名空间将更新到最新版本。但是 bin 文件夹报告将构建为与目标报告服务器版本兼容。
下面的设置应该设置为你的特定版本的 SSRS,然后从 \bin 目录中获取 RDL
或者,在更新 TargetServerVersion 后,只需使用 rdl 中的 right click | deploy
。
接受的答案比 difficult/prone 到 error/unlikely 多得多,可以跨多个版本的 ssrs 工作,并且每次更改 rdl 时都需要应用。
我最近 运行 也关注这个问题。我发现我只需要更改有问题的 .rdl 文件中的两项。
更改自:
报告 xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
收件人:
举报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"
与其他回复不同,我需要 2010 而不是 2008。我会检查您已经部署的 .rdl 文件。
- 删除 "ReportParametersLayout" 块。
注意:如果我删除了 ReportSections 块,它不会像其他人所说的那样工作。
我已将此任务自动化。
创建一个带有名为 "TextBoxFile" 的文本框和一个按钮的表单。 在点击按钮的代码中:
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(TextBoxFile.Text)
Dim root = xmlDoc.DocumentElement
For Each elel As XmlNode In root.ChildNodes
Debug.WriteLine(elel.Name & " " & elel.NodeType)
Next
If root.Attributes()("xmlns").Value <> "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" Then
root.Attributes()("xmlns").Value = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
End If
Dim nsmgr = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("bk", "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition")
Dim autoRefreshElements = root.GetElementsByTagName("AutoRefresh")
While autoRefreshElements.Count > 0
root.RemoveChild(autoRefreshElements(0))
End While
Dim ReportParametersLayout = root.GetElementsByTagName("ReportParametersLayout")
While ReportParametersLayout.Count > 0
root.RemoveChild(ReportParametersLayout(0))
End While
Dim ReportSections = root.GetElementsByTagName("ReportSections")
If ReportSections.Count > 0 Then
' Move content of ReportSections just below the block.
Dim ReportSection = ReportSections(0).ChildNodes()
' First, copy the elements after
Dim precedent = ReportSections(0)
For Each child As XmlNode In ReportSection(0).ChildNodes
Dim clone = child.Clone
root.InsertAfter(clone, precedent)
precedent = clone
Next
' After deleting the existing block
While ReportSections.Count > 0
root.RemoveChild(ReportSections(0))
End While
End If
xmlDoc.Save(TextBoxFile.Text)
MsgBox("Ok")
我在切换到 VS2017 并安装 Report Designer 版本 14.2 时遇到了同样的问题。
对我来说,只需 3 个步骤即可解决问题。
1:将 xmlns
设置为“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition”
2:删除 ReportSections
" 和 "ReportSection
"(仅限标签)。
3: 删除报告 ReportParametersLayout
部分。
你唯一需要记住的就是将xmlns指向2008/01
换成2008/01后尝试运行报告,错误信息中可以看到另外2个步骤
如果您在使用 LocalReport (RDLC) 的 Visual Studio 2017 C# 桌面应用程序中遇到问题,请查看此答案:
最简单直接的解决方案。我建议你在当前项目的 Manage NuGet Packages 中找到 Microsoft.ReportingServices.ReportViewerControl.WebForms 并将此 dll 版本更新到最新版本。
从 VS 菜单导航:工具 > NuGet 包管理器 > 管理解决方案的 NuGet 包
通过本地管理员帐户登录并通过删除和创建这些计算机对象来更正这些计算机对象。