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)
Please note that you MUST delete the file “Global.asax”.
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 6: Right click on the website and click properties. Change the properties to be as in the below image Note that you must make the site not updatable and using fixed naming.
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.
Please note that we did NOT copy the empty Site.Master file and did nothing to it.