You can write the creation date of your xap file to the initParams of the Silverlight object.
<object id="xaml" data="data:application/x-silverlight-2," type="application/x-silverlight-2"> <param name="initParams" value="<%= GetInitParams() %>" />
In the code behind the file, you write something like this:
protected string GetInitParams() { string xappath = HttpContext.Current.Server.MapPath(@"~/ClientBin/YourXapFile.xap"); DateTime xapCreationDate = System.IO.File.GetLastWriteTime(xappath); return string.Format("lastUpdateDate={0:d}, xapCreationDate); }
In the Silverlight client, you can compare this date with the latest application store update. You can find the date and time of the last update using the GetLastWriteTime() method of the IsolatedStorageFile object.
Then you compare these two dates and delete the file with Deletefile , if necessary.
slfan source share