So I was making some changes to a deploy script, and brought up the .rss file in sharpdevelop, simply for the fun of intellisense.
I got bored, and decided to reference rs.exe ans see if it would decorate all my code for me.
I eventually realized the following:
All rs does is take the -v paramaters, make them into variables, through your .rss file in (its already a sub main), compile and execute it.
So, to step through your .rss scripts on-the-fly, or to completely replace them with a custom assembly, do this:
1) Create a new console application
2) Reference rs.exe in your project (in $SQLSRVR\blah\blah\binn)
3) Reference System.Web.Services
4) Imports Microsoft.SqlServer.ReportingServices
5) Declare your parameters as module level variables
6) Public Sub main() is the same code you'd put in the .rss file.
Hooray, no more stumbling in the dark, and your installer can be unit tested, refactored, resharped, signed, encrypted and converted to unmanaged C++, inlined assembly, or whatever your black heart desires.
NOTE:, rs.LogOnUser throws an error that it's not supported in RS for Sql Server 2000. I guess you can only run with the credentials of the launching user, or find some other way to impersonate.
Obligatory rant: why did have they give these files .rss extensions? Can they not spend a half a minute on google to see if rss already means something?
Oops, I forgot the important part, add this global instance of variable rs:
Public rs As ReportingService = New Microsoft.SqlServer.ReportingServices.ReportingService()
Subscribe to:
Post Comments (Atom)
2 comments:
How do you pass the '-s' server path?
Found it (Using ReportingService2010 agains SQL2008R2)
Set up the module items like this:
Public rs As New ReportingService2010()
Private roleName As String = "Browser"
Private userName As String = "MyGroupName"
Private itemPath As String = "/MyFolder"
Private keepCurrentPolicy As String = "True"
Sub Main()
' These are initialisers for running within a Visual tudio Project
' and should not be included when the code is used as an .rss script
rs.Url = "http://localhost/ReportServer/ReportService2010.asmx"
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Post a Comment