I am in the process of migrating all of our reporting needs to RS 2005.
Everything is going good, however I do have some issues deploying
reports. We have many reports and I would like to keep them all in one
master project file in VS.NET but deploy them to different folders to
help users find the correct report. I have a root directory of
\Reporting and several sub directories on the report server such as
\VendorReports\, \ClientReports, \UserReports, \ProfitabilityReports,
etc. The only way I have found to be able to deploy correctly is to
have a separate VS.NET project for each sub directory.
As I keep adding reports I will need to organize these even further,
such as \VendorReports\Performance, \VendorReports\Cost, etc.
Is there a way I can specify at the .rdl level which folder the report
should deploy to? This would make development much easier for me if I
could just have a master project that contained all of the reports.
Any ideas are appreciated.
Thanks
ChrisWe use a deployment script, we deploy to a single folder though, we organize
the structure in the web app, not too many reports yet.
'=====================================================================' File: PublishDatasource.rss
'
' Summary: Script that can be used with RS.exe to
' publish datasource to Reporting Services.
'
' 6/14/05: Initial creation from 2-3 previous scripts
'
'---
' Sample Usage:
'
'
'=====================================================================*/
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim parentPath As String = "/" + ReportDir
Dim varReturn As String
Public Sub Main()
Console.WriteLine()
Console.WriteLine("****************************************************************")
Console.Writeline("File Path to reports (filePath): " & filePath)
Console.Writeline("Web Path to publish to (ReportDir): " & parentPath)
Console.Writeline("Report Server Datasource Server (RSDBServer): " &
RSDBServer)
Console.Writeline("Report Server Datasource DB Name (DataDB): " & DataDB)
Console.Writeline("Report Server Datasource User (DataDBUser): " &
DataDBUser)
Console.Writeline("Report Server Datasource Pwd (DataDBPwd): " & DataDBPwd)
Console.Writeline("Report Server Datasource Name (RSDSName): " & RSDSName)
Console.WriteLine("****************************************************************")
'Call the createfolder routine to create the subfolder from the root
Console.WriteLine("Creating subfolder if possible")
CreateFolder(ReportDir)
'call the createdatasource routine to create the datasource
Console.WriteLine("Creating SQL Data Sources if possible")
CreateSQLDataSource(RSDBServer, DataDB, DataDBUser, DataDBPwd, ReportDir,
RSDSName)
End Sub
Public Sub CreateSQLDataSource(ByVal serverName as String, ByVal
databaseName as String, ByVal userName as String, ByVal password as String,
ByVal dspath as String, ByVal dsname as String)
Dim name As String = dsname
Dim parent As String = "/" & dspath
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Store
definition.ConnectString = "data source=" & serverName & ";initial
catalog=" & databaseName
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
definition.Username = userName
definition.Password = password
'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("yep, there was an error...")
Console.WriteLine(e.Message)
End Try
End Sub
'-- Added logic to split and build folder tree structure.
Public Sub CreateFolder(ByVal folderName As String)
Dim Counter As Integer
Dim ReportArray() As String
Dim ParentFolder As String
ParentFolder = "/"
ReportArray = folderName.Split("/")
For Counter = 0 To ReportArray.Length - 1
Try
rs.CreateFolder(ReportArray(Counter), ParentFolder, Nothing)
Console.WriteLine("Folder created: {0}", folderName)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
ParentFolder = "/" + ReportArray(Counter)
Next
End Sub
'=====================================================================' File: PublishReports.rss
'
' Summary: Script that can be used with RS.exe to
' publish reports to Reporting Services.
'
' 6/14/05: Initial creation from 2-3 previous scripts
'
'---
' Sample Usage:
'
'
'=====================================================================*/
Public Sub Main()
PublishReport()
End Sub
Public Sub PublishReport()
Dim dir As DirectoryInfo = new DirectoryInfo("..\")
Dim fsi As FileSystemInfo
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim parentPath As String = "/" + ReportDir
Dim f As FileInfo
Dim warning As Warning
For Each fsi In dir.GetFileSystemInfos("*.rdl")
Try
f = CType(fsi, FileInfo)
Dim stream As FileStream = File.OpenRead(dir.ToString() +
f.ToString())
definition = New [Byte](stream.Length) {}
stream.Read(definition, 0, CInt(stream.Length))
stream.Close()
warnings =rs.CreateReport(Path.GetFileNameWithoutExtension(f.ToString()), parentPath,
True, definition, Nothing)
DSChange(fsi.Name.Split(".".ToCharArray())(0))
If Not (warnings Is Nothing) Then
Console.WriteLine("Report published successfully WITH warnings:
{0} ", Path.GetFileNameWithoutExtension(f.ToString()))
Else
Console.WriteLine("Report published successfully - no warnings:
{0}", Path.GetFileNameWithoutExtension(f.ToString()))
End If
Catch e As Exception
Console.WriteLine(e.Message)
End Try
Next fsi
End Sub
Sub DSChange(ByVal ReportName As String)
Dim reference As new DataSourceReference()
Dim ds As New DataSource()
Dim dataSources() As DataSource
Try
reference.Reference = "/" & ReportDir & "/" & RSDSName
DataSources = rs.GetItemDataSources("/" & ReportDir & "/" &
ReportName)
ds = DataSources(0)
ds.Item = CType(reference, DataSourceDefinitionOrReference)
rs.SetItemDataSources("/" & ReportDir & "/" & ReportName,
DataSources)
Console.WriteLine("datasource reference set")
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
"chris" <ce.young1@.gmail.com> wrote in message
news:1159812447.026396.137570@.i3g2000cwc.googlegroups.com...
>I am in the process of migrating all of our reporting needs to RS 2005.
> Everything is going good, however I do have some issues deploying
> reports. We have many reports and I would like to keep them all in one
> master project file in VS.NET but deploy them to different folders to
> help users find the correct report. I have a root directory of
> \Reporting and several sub directories on the report server such as
> \VendorReports\, \ClientReports, \UserReports, \ProfitabilityReports,
> etc. The only way I have found to be able to deploy correctly is to
> have a separate VS.NET project for each sub directory.
> As I keep adding reports I will need to organize these even further,
> such as \VendorReports\Performance, \VendorReports\Cost, etc.
> Is there a way I can specify at the .rdl level which folder the report
> should deploy to? This would make development much easier for me if I
> could just have a master project that contained all of the reports.
> Any ideas are appreciated.
> Thanks
> Chris
>
No comments:
Post a Comment