Karen Corby has published a template for Visual Studio that allows you to seamlessly switch between compiling for a standalone application and compiling for an .xbap. Even more nifty, she has added support for conditional compiles in both code and XAML depending on if you are targeting an application w/ full trust or an .xbap with partial trust. Note that when you go to install the template, literally copy the .zip file to the Templates directory; don't unzip it. (This threw me initially.)
This inspired me to update the Monkeys Jumping sample and also make it available as an .xbap now that the NETFX3 server is configured to deploy .xbaps.