How-To: Show Features Only in Beta Builds

By Jared Bienz

I was recently asked how to add a “Submit a Bug” feature to an app but only make it visible for Beta builds.

The code to actually send the bug was quite simple:

EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = "My App Feedback";
emailComposeTask.To = "[email protected]";

Now the question is where to put it. Obviously this could be triggered from a button click, a menu item, or any other control on the screen. But if we only want the item to show up on beta builds we have some extra work to do.

One of the ways I like to deal with this is by adding a new configuration to the Configuration Manager.

In Visual Studio click the Configuration drop-down and choose “Configuration Manager”.


In Configuration Manager, choose to create a new configuration.


Call the configuration “Beta” and choose to copy settings from Release.


Click OK to close the dialog.

Make sure “Beta” is selected in the configuration drop-down.

Right click on the project and choose “Properties”.


Switch to the “Build” tab.

Add a new conditional compile symbol called BETA.


Close the project properties window and make sure you saved your changes.

Now, anywhere in the code you can use BETA as a conditional compile statement.

#if BETA
contactButton.Visibility = Visibility.Visible;

Now you can easily switch between Debug, Release and Beta builds using the configuration drop-down at the top in Visual Studio!

Reprinted with permission from Microsoft Corporation.

More by Author

Must Read