如何仅在 *.rdl 文件上 运行 build/deploy
How to run build/deploy only on *.rdl files
我正在 运行 从 CMD
执行以下构建命令(运行s 在 windows
从 jenkins
上):
bat "devenv.com MyProject.sln /Build Release"
我对 bin\Release
的输出是 *.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
有办法避免吗?例如,运行 构建并仅查看 bin\Release
中的 *.rdl
文件或修改 Upload_Multiple_RDL_files.rss
VB
我从 this answer 获取的脚本到 运行 仅在 *.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
我不是 VB
专家,但在添加此 if
条件后,以下对我有用:
If NameWithExt Like "*rdl*" Then
完整脚本:
'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))
If NameWithExt Like "*rdl*" Then
warnings = rs.CreateReport(NameOnly, ServerDir, True, definition, Nothing)
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
我正在 运行 从 CMD
执行以下构建命令(运行s 在 windows
从 jenkins
上):
bat "devenv.com MyProject.sln /Build Release"
我对 bin\Release
的输出是 *.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
有办法避免吗?例如,运行 构建并仅查看 bin\Release
中的 *.rdl
文件或修改 Upload_Multiple_RDL_files.rss
VB
我从 this answer 获取的脚本到 运行 仅在 *.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
我不是 VB
专家,但在添加此 if
条件后,以下对我有用:
If NameWithExt Like "*rdl*" Then
完整脚本:
'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))
If NameWithExt Like "*rdl*" Then
warnings = rs.CreateReport(NameOnly, ServerDir, True, definition, Nothing)
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