Using different WMAppManifest files for release and debug builds

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 and WMAppManifest.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

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.

Last updated by at .