So the
Solution with it All can only be deployed by installer scripts because:
- Its a damn good way to deploy applications
- It stops 'oh just deploy that file and it will work'
- Even a monkey could install this solution across 5 servers
Problem being... Visual Studio .NET 2003 has Web Setup Projects, Database Projects etc. so I can easily deploy all my web apps, my sql databases etc. but there is no easy way to deploy SQL Reporting Services Reports...
Guess Again...
With a bit of R&D and some help from Teo Lachev (Author: "Microsoft Reporting Services in Action") I re-configured the ReportPublishing Sample.
The deployment solution consists of:
Base Folder - C:\Deployment\Anguss_Reports
Anguss Timesheets.rdl - a standard Report Definition created with VS.NET 2003
Anguss Phone Bill By Person.rdl - a standard Report Definition created with VS.NET 2003
Deploy.bat
rs -i PublishReports.rss -s http://localhost/reportserver -v parentFolder="Angus's Reports"
PublishReports.rss
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim parentPath As String = "/" + parentFolder
Dim filePath As String = "C:\Deployment\Anguss_Reports\"
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim name As String
'Create the parent folder
Try
rs.CreateFolder(parentFolder, "/", Nothing)
Console.WriteLine("Parent folder created: {0}", parentFolder)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
CreateSampleDataSource()
PublishReport("Anguss Timesheets")
PublishReport("Anguss Phone Bill By Person")
End Sub
Public Sub CreateSampleDataSource()
Dim name As String = "AngussDatasource"
Dim parent As String = "/" + parentFolder
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = "data source=(local);initial catalog=AngussDatabase"
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
Try
rs.CreateDataSource(name, parent, False, definition, Nothing)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
Public Sub PublishReport(ByVal reportName As String)
Try
Dim stream As FileStream = File.OpenRead(filePath + reportName + ".rdl")
definition = New [Byte](stream.Length) {}
stream.Read(definition, 0, CInt(stream.Length))
stream.Close()
Catch e As IOException
Console.WriteLine(e.Message)
End Try
Try
warnings = rs.CreateReport(reportName, parentPath, False, 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 successfully with no warnings", reportName)
End If
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
pause
Posted
Oct 03 2004, 07:24 PM
by
anguslogan