Using Different WMAppManifest Files for Release and Debug Builds – Part Deux
Awhile ago I wrote a post describing how to change your application’s name when deploying from Visual Studio in order to differentiate Store version from your development version. To do that, I used Pre-build events to replace the
WMAppManifest.xml file with Debug or Release version.
There is another way to do that – by using MSBuild.
First, create two extra
WMAppManifest.xml files and name them
WMAppManifest.Release.xml in the
Properties folder. Change the application’s title to something else in the Debug version, and use the desired name in the Release version. I recommend adding a
! before your application’s name. This way your application will be at the top of the applications list.
Both debug and release manifests along with the real one
Now, right click on the project file and select Unload Project. After the project is unloaded, right click again and click Edit YOURPROJECTNAME.csproj to open the project file. Scroll down until you find comment about modifying build process. Immediately after add the following XML:
<Target Name="BeforeBuild"> <Delete Files="Properties\WMAppManifest.xml" /> <Copy SourceFiles="Properties\WMAppManifest.Debug.xml" DestinationFiles="Properties\WMAppManifest.xml" OverwriteReadOnlyFiles="True" Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " /> <Copy SourceFiles="Properties\WMAppManifest.Release.xml" DestinationFiles="Properties\WMAppManifest.xml" OverwriteReadOnlyFiles="True" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " /> </Target>
Save the file and reload the project. Similarly to the technique used in the other blog post, if we are in debug configuration, the debug version will be copied over the real
WMAppManifest.xml file and release version will be copied in release configuration.
Of course, if you have changed your configurations, you need to adjust the XML above. That’s it, don’t forget to add exclamation point before Title in the Debug build to ensure top location for your application.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)