DotNet / 编程技术 · 2022年3月17日

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
Micirsoft.SqlServer.Types是依赖库,会自动安装
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”>
在较新版本的VS中编辑报表文件,则报表中格式版本会自动升级到新版本,要注意,在新版本编辑后,就无法在低版本VS中编辑

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

VS2019会升级到V2016,需要把ReportView升级到V15匹配
升级到V15后,会自动加入一个目录:SqlServerTypes
并要求加入一个程序集导入的语句
    SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
另外:自动生成的导入语句为C#重句,如需要在VB.net下使用,需要手动翻译成vb,代码如下:
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

最新电影,电视剧,尽在午夜剧场

电影电视剧午夜不寂寞