Although the requirement I had was to add a custom page and customize the BizTalk BAM portal; this post actually applies to any web application that is using the compiled web site template.
The BAM portal is the business analysis and monitoring portal that comes with BizTalk server. This is actually a portal that is using the compiled web site template.
The need was to add several custom pages to this portal so that they would be completely integrated with the portal. Meaning that they should be using the same master page and hence include all the main menu and links within this master page.
Now if this is a web application that would be an easy task (right?) since you would have already the mark up of the master page file but since this is a compiled website the site.master is actually a placeholder file and contains nothing L
Step 1: So what I did is that I created a new website with any name. In this new website you would get a complete solution with many out of the box files as below:
Step 2: Now what we need to do is to delete all things we don’t need. So basically you need to delete everything except:
2- Web.config (Although we don’t need it it will not compile without this)
Step 3: Now we need to mimic the structure of the BAM portal. So we create a new folder called “MasterPages” and move the Site.Master to this folder.
Step 4: Create a folder called Pages and create any needed custom ASPX pages to this folder. These pages should refer to the master page already moved to the same folder as the original BAM website as described above.
Step 5: If you want to refer to available classes and helper methods within the original web site then add references to the needed assemblies. For me that was “Microsoft.BizTalk.Bam.Portal.dll”
Step 7: Make sure that you are targeting the same .NET framework as the original website. For my case that’s .NET 4.0
Step 8: Right click on the web site and click deploy and select a valid deployment folder (not an IIS website)
Step 9: Now open the deployment PrecompiledWeb folder and then copy the ASPX custom pages from the pages folder to the pages folder under the original website. Also copy the pages compiled files and DLLs from the bin folder to the original website bin folder.
That’s basically it and now your pages would has the same master page as the BAM portal.