.NET Zone is brought to you in partnership with:

My name is Toni Petrina and I am a software developer and an occasional speaker. Although I primarily develop on the Microsoft stack, I like to learn new technologies. My hobbyist projects range from game development, regardless of the technology, to ALM. I spend most of my time with my girlfriend and someday I will learn how to play the guitar properly. Toni is a DZone MVB and is not an employee of DZone and has posted 69 posts at DZone. You can read more from them at their website. View Full User Profile

Using Different WMAppManifest Files for Release and Debug Builds

04.25.2013
| 2643 views |
  • submit to reddit

While working on an update for already released application, you might find yourselves having both the marketplace version and developer version. Since they use (almost) the same manifest, you will have a hard time guessing which one is the marketplace version and which one is the one in development. It would be enough to simply change the application’s name, but you might forget to revert the name once the application is published.

Luckily, we can use different manifests for debug and release builds and use build events to replace the manifest depending on the build.

First, create two copies of current WMAppManifest.xml file and name them WMAppManifest.Debug.xml andWMAppManifest.Release.xml. You can now change application’s title in the debug manifest e.g. add (dev) to the end of it. Even better, you can prepend # to the title which will then place your application at the top of applications list.

Your solution should look like this:

Both debug and release manifests along with the real one

Now you need to open project’s properties and navigate to Build Events page. In the Pre-build event command line copy the following snippet:

del "$(ProjectDir)Properties\WMAppManifest.xml"

if "Debug"=="$(ConfigurationName)" (
copy "$(ProjectDir)Properties\WMAppManifest.Debug.xml" "$(ProjectDir)Properties\WMAppManifest.xml"
) else (
copy "$(ProjectDir)Properties\WMAppManifest.Release.xml" "$(ProjectDir)Properties\WMAppManifest.xml"
)

This will delete current manifest and replace it with the one for the current build configuration. While this works as expected for debug builds, you will have a hard time differentiating between release build and installed marketplace version. This can be solved by introducing a third build configuration – “Marketplace”. But this might prove too complicated for most cases.

Enjoy.

Published at DZone with permission of Toni Petrina, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)