RDLC报表各版本以及VisualStudio的版本匹配关系
V12
运行时版本: v2.0.50727
安装包名称:Microsoft.ReportViewer.2015
在.Net Framework3及刚升级到4的(使用推荐)
报表中格式版本:
<Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition” xmlns:rd=”http://schemas.microsoft.com/SQLServer/reporting/reportdesigner”>
V15
运行时版本: v4.0.30319
安装包名称:Microsoft.ReportingServices.ReportViewerControl.****,如:Microsoft.ReportingServices.ReportViewerControl.Winforms


RDLC设计器版本:Microsoft RDLC Report Designer 15.3
在.Net Framework4下面运行使用推荐
报表中格式版本:
<Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition” xmlns:rd=”http://schemas.microsoft.com/SQLServer/reporting/reportdesigner”>

VS2015中会升级到V2008,需要把ReportView升级到V12匹配
VS2019会升级到V2016,需要把ReportView升级到V15匹配

并要求加入一个程序集导入的语句
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Namespace SqlServerTypes
Public Class Utilities
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function LoadLibrary(libname As String) As IntPtr
End Function
Public Shared Sub loadNativeAssemblies(pRootApplicationPath As String)
Dim pNativeBinaryPath As String = IIf(IntPtr.Size > 4, Path.Combine(pRootApplicationPath, "SqlServerTypes\x64\"), Path.Combine(pRootApplicationPath, "SqlServerTypes\x86\"))
loadNativeAssembly(pNativeBinaryPath, "msvcr120.dll")
loadNativeAssembly(pNativeBinaryPath, "SqlServerSpatial140.dll")
End Sub
Private Shared Sub loadNativeAssembly(pNativeBinaryPath As String, pAssemblyName As String)
Dim pPath = Path.Combine(pNativeBinaryPath, pAssemblyName)
Dim pPtr = LoadLibrary(pPath)
If pPtr = IntPtr.Zero Then
Throw New Exception(String.Format("Error loading {0} (ErrorCode:{1})", pAssemblyName, Marshal.GetLastWin32Error()))
End If
End Sub
End Class
End Namespace