Click here to Skip to main content
6,634,665 members and growing! (19,715 online)
Email Password   helpLost your password?
Database » SQL Reporting Services » General     Intermediate

Custom MSBuild Tasks: Automated Report and DB Deployment

By Thiago Silva

Automate your Reporting Services report deployment and scripting and database tasks by using these custom MSBuild tasks.
C#, XML, Windows, .NET 2.0SQL 2000, SQL 2005, VS2005, Architect, DBA, Dev
Posted:22 Jun 2006
Views:32,679
Bookmarked:27 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
7 votes for this article.
Popularity: 2.49 Rating: 2.94 out of 5
1 vote, 14.3%
1
3 votes, 42.9%
2

3
2 votes, 28.6%
4
1 vote, 14.3%
5

Sample Image - CustomMSBuildTask_RS.jpg

Introduction

This library wraps the RS.exe tool and the OSQL.exe tool in custom MSBuild tasks, so you can automate Reporting Services Report and Scripting deployment, and SQL Server object scripting into an MSBuild project. The Osql custom task is based on the sample by Joey Benninghove, found on his blog.

You can create custom tasks for MSBuild by extending/deriving from the Task base class or by implementing the ITask interface. Feel free to use the source code, and please send me any comments or improvements.

Usage

To consume one of these tasks, just create an XML-based MSBuild project file like the following, and run it using the MSBuild.exe command:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DeployReportCatalog" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile=
  "C:\Projects\Silvaware.MSBuild.Tasks\bin\Debug\Silvaware.MSBuild.Tasks.dll" 
  TaskName="Rs" />

 <PropertyGroup>
    <SqlToolsFolder>C:\program files\microsoft sql server\90\Tools\Binn
    </SqlToolsFolder>  
    <RsTool>$(SqlToolsFolder)\rs.exe</RsTool>
    <TargetReportServer>http://localhost/ReportServer</TargetReportServer>
</PropertyGroup>

 <ItemGroup>
     <TargetItems Include="**\*.rss" />
 </ItemGroup>

 <Target Name="DeployReportCatalog">   
     <Rs RsPath="$(RsTool)" InputFile="@(TargetItems)" 
         ServerURL="$(TargetReportServer)" WaitForExit="true" />
 </Target>

</Project>

The example above executes all Reporting Services script files (.rss) found in the subdirectories of this project recursively. These .rss files could contain VB.NET code to deploy report RDLs, datasources, create folders, roles, assign security, etc.

All the arguments/parameters that the RS.exe and the OSQL.exe tool can take from the command line have been exposed in the custom task as public properties, such as the RsPath and the InputFile properties used in the above example.

Happy MSBuild-ing!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Thiago Silva


Member
Thiago started programming on Turbo Pascal at age 17, and quickly moved on to java and VB6, eventually moving to .NET. He has implemented custom ASP.NET applications, and C# class libraries for several clients.

Currently, Thiago's main kick has been in SQL Server Reporting Services, having worked with several clients to provide report design and development, and helping them architect their reporting solution.

Thiago Silva is currently a consultant with a very well-recognized company in the Business Intelligence realm, and is part of their Microsoft practice.
Occupation: Web Developer
Location: United States United States

Other popular SQL Reporting Services articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
GeneralA couple of minor modifications Pinmemberdeiussum10:46 16 Jun '09  
General[Message Removed] Pinmemberstonber8:37 6 Oct '08  
GeneralContribute ti tigris Pinmemberwinstanley-john8:00 2 Oct '07  
GeneralQuestion. PinmemberRZOE13:10 16 May '07  
GeneralRe: Question. PinmemberThiago Silva9:20 12 Jun '07  
GeneralRe: Question. PinmemberMember 25561263:54 24 Mar '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 22 Jun 2006
Editor: Smitha Vijayan
Copyright 2006 by Thiago Silva
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project