【发布时间】:2021-04-26 11:59:47
【问题描述】:
我正在从CMD 运行以下构建命令(在windows 从jenkins 上运行):
bat "devenv.com MyProject.sln /Build Release"
我对@987654326@的输出是*.rdl文件+*.obj files+*.rds files
之后,我正在运行以下部署命令:
bat ' rs.exe -i pipeline/ssrs/Upload_Multiple_RDL_files.rss -s "{My report server}" -v FILE_NAME="pipeline/ssrs/ConfigurationFile.txt" '
一旦到达非 rdl 文件,我就会收到错误:
The definition of this report is not valid or supported by this version of Reporting Services
有办法避免吗?例如,运行 build 并仅查看 bin\Release 中的 *.rdl 文件,或者修改我从 this answer 获取的 Upload_Multiple_RDL_files.rss VB 脚本以仅在 *.rdl 文件上运行?
Upload_Multiple_RDL_files.rss内容:
'Script Starting Point
' Script to deploy report to report server
' EXECUTE VIA COMMAND LINE
DIM definition As [Byte]() = Nothing
DIM warnings As Warning() = Nothing
Public Sub Main()
' Variable Declaration
Dim TextLine As String = ""
Dim LocalDir As String = ""
Dim ServerDir As String = ""
Dim definition As [Byte]() = Nothing
'Dim warnings As Warning() = Nothing
' Reading Configuration Text file and assigning the values to variables
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do While objReader.Peek() <> -1
TextLine = objReader.ReadLine()
Dim parts As String() = TextLine.Split(New Char() {","c})
'TextLine & objReader.ReadLine() '& vbNewLine
LocalDir = parts(0)
ServerDir = parts(1)
Dim path As String = LocalDir
Dim fileEntries As String() = Directory.GetFiles(path)
Dim fileFullPath As String = ""
For Each fileFullPath In fileEntries
' Deploying the Reports
Try
Dim stream As FileStream = File.OpenRead(fileFullPath)
Dim NameWithExt As String = fileFullPath.Replace(path, "")
Dim NameOnly As String = NameWithExt.Replace(".rdl", "")
definition = New [Byte](stream.Length-1) {}
stream.Read(definition, 0, CInt(stream.Length))
warnings = rs.CreateReport(NameOnly, ServerDir, True, definition, Nothing)
If Not (warnings Is Nothing) Then
DIM warning As Warning
For Each warning In warnings
Console.WriteLine(warning.Message)
Next warning
Else
Console.WriteLine("Report: {0} PUBLISHED!", NameOnly)
End If
Catch e As IOException
Console.WriteLine(e.Message)
End Try
Next fileFullPath
Loop
Else
Dim MsgBox as String = "File Does Not Exist"
End If
End Sub
'End of the Script
【问题讨论】:
标签: vba reporting-services command-line rdl