Thursday 2 March 2017

Build SSRS Project OR Solution with MSBuild by customizing build template

In build definition, there is trigger option called “Gated Check-in”. When this option is selected in build definition, any check-in happened in the associated workspace will trigger a verification build. Once the build succeeds, the code changes will be submitted to the repository and the projects related folder are created on the build drop location. Microsoft MS build support only web project to be built during this process.

During the deployment process in release management, I wanted to build the SSRS project along with my other projects during the gated check-in build. But unfortunate MS build (in my case MS Build v12.0) doesn’t support to build the SSRS project during gated check-in trigger.

So to get published SSRS report files along with web project I customized the build template process and added the customs process flow to build SSRS project.

Here are the simple steps to include SSRS project into build template process to build along with other projects.

Steps 1 #
Download your default build template and save it on your local machine.

Steps 2 #
After download, your template, create a new Activity library project and add your default template in the project.

Steps 3 #
Double click on template XAML file and add new “Invoke process” after “Run MSBuild” activity as showing in below image. Here we forcefully invoke our custom process to build the solution to include SSRS project in the build process.

Steps 4 #
Set following Invoke process properties value.

Sr.No
Name
Value
1.
Arguments
"/Build Release """ + SourcesDirectory + "\My.sln"""
2.
FileName
"""C:\Program Files (x86)\Microsoft Visual Studio

 12.0\Common7\IDE\devenv.exe"""
3.
OutputEncoding
System.Text.Encoding.GetEncoding(System.Globalization.

CultureInfo.InstalledUICulture.TextInfo.OEMCodePage)
Note:-  “SourceDirectory “ is the system variable.
After completing above process, build the Activity project to check any compiled time error.

Steps 5 #
Once invoke process will build the SSRS project, we have to copy build files (here .rdl report files) from source control’s bin directory to drop folder.
Add the activity to create the directory and to copy the files.

Create SSRS Directory
Directory : BinariesDirectory + "\_PublishedWebsites\" + "Reports"

Copy SSRS Reports
Destination : BinariesDirectory + "\_PublishedWebsites\" + "Reports"
Source : SourcesDirectory + "\Report\bin\Release"

Note:- “SourceDirectory “ and “BinariesDirectoy” are the system variable.

Steps 6 #
Once done with above steps, add custom template into TFS source control folder so that it’s easily available to set as an active template.
Set modified template as a current template and trigger the check-in with Gated check-in option.
After setting custom template do one check-in with gated check-in trigger option.
It should copy the reports files (.rdl) in your build drop location.
I hope above steps will help you to build SSRS project file using gated check-in trigger.

About Author:
Pushkar Rathod is a consultant in Systems Plus Pvt. Ltd. Within Systems Plus, he actively contributes to the areas of Technology and Information Security. He can be contacted at: pushkar.r@spluspl.com

4 comments:

  1. Hello Pushkar,
    Thanks a lot for the post. Can you share the new XAML file if possible?
    If not, can you please go more into details? I can see stuff in the screenshots that are not mentioned in your explanation.
    Thanks a lot!

    ReplyDelete
  2. The information within the snaps to understand the building of customized template which is really useful. Thank you very much. Best IT company in Coimbatore | Business solution provider in Coimbatore

    ReplyDelete
  3. It is a great sharing...I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. I enjoyed every little bit part of it.Web Design Sydney, Logo Design Sydney

    ReplyDelete