.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 – Part Deux

09.09.2013
| 1925 views |
  • submit to reddit

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.Debug.xml andWMAppManifest.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.

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.)