Jesper Niedermann's .NET Blog
about .NET and related technologies RSS 2.0
# Sunday, 24 July 2011

When we were to publish a free version of our new Windows Phone Game Photo Challenge I wanted to maintain both the free and paid version in the same Repository. I wanted the solution file and project file for the new free app to use the same source files as the paid app. This gave some headaches because there needs to be a physical WMAppManifest.xml file for each App. I googled various approaches but I finally made up an entirely different approach which I thought fitted our project best. Here is the steps I took:

  • Copied the solution file PhotoChallenge.sln to PhotoChallengeFree.sln – placed in the same folder
  • Copied the project file PhotoChallenge.csproj to PhotoChallengeFree.csproj – placed in the same folder
  • Changed PhotoChallengeFree.sln via notepad to refer to PhotoChallengeFree.csproj
  • Copied AssemblyInfo.cs to two new folders. One for the paid app and one for the free app.
  • Deleted AssemblyInfo.cs from both PhotoChallenge.csproj and PhotoChallengeFree.csproj
  • From PhotoChallenge.csproj I linked to the new Paid version of AssemblyInfo.cs – using Add –> Existing File, but choosing Add As Link instead of Add.
  • The same in PhotoChallengeFree.csproj. But this time linking to the Free version of AssemblyInfo.cs
  • Changed the following properties in the free version of AssemblyInfo.cs: AssemblyTitle, AssemblyProduct and Guid.

I actually wanted to manipulate WMAppManifest.xml in the same way as I did AssemblyInfo.cs. But this turned out to be impossible. The WMAppManifest.xml file has to be physical – not a link. Instead I did this:

  • Made a project folder in PhotoChallenge.csproj called PropertiesPaid
  • Made a project folder in PhotoChallengeFree.csproj called PropertiesFree
  • Copied WMAppManifest.xml to the new folders and added the relevant one to each project.
  • Deleted WMAppManifest.xml from the properties folder.
  • Opened the project files in Notepad (actually I chose “Unload Project” in Visual Studio and then “Edit PhotoChallenge.csproj”). And changed this:

To this:


Then I reloaded the project in Visual Studio, and did the same for the free project. But now refering to the PropertiesFree folder.

In the free version of WMAppManifest.xml I changed the Title and TokenId to match the AssemblyTitle and AssemblyProduct of AssemblyInfo.cs. Furthermore I changed the ProductId to match the Guid of the AssemblyInfo.cs.

The actual differences between the free and paid version in the source file I maintain using a new compilation symbol I made called “FREE” so I can make statements like this:

#if FREE
//Some code

Altogether my approach seems to work extremely well to minimize maintainance of the two versions of the same app.

One small problem: For some reason which I have not bothered to find out I cannot use the Compilation symbol Free in the PhotoChallenge.csproj project itself, but I have some other referenced projects where it is no problem. So I just have a class in the referenced project which I can use where ever I have to check if the current version is paid or free:

public static class Edition
public static bool IsFree
#if FREE
return true;
return false;
Sunday, 24 July 2011 19:46:58 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
Visual Studio | Windows Phone 7
Comments are closed.
<2018 August>
About the author/Disclaimer
I am a software architect with focus on Microsoft Technologies. I have been working with these in different large companies since 1995. I am currently employed at UVdata A/S.
Here is my View Jesper Niedermann's profile on LinkedIn

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Privacy policy
The privacy policy of this site.

© Copyright 2018
Jesper Niedermann
Sign In
Total Posts: 28
This Year: 0
This Month: 0
This Week: 0
Comments: 32
All Content © 2018, Jesper Niedermann
DasBlog theme 'Niedermann' created by Jesper Niedermann, based on 'Business' created by Christoph De Baene (delarou)