private static bool UpdateVersionAttributeWithLatestVersionAdjusted(XAttribute versionAttribute, out Version version)
        {
            string versionString = versionAttribute.Value;

            Version manifestVersion;
            bool success = Version.TryParse(versionString, out manifestVersion);
            if (success)
            {
                TimeSpan elapsedTime = DateTime.Today.Subtract(Epoch);
                int build = Convert.ToInt32(elapsedTime.TotalDays);

                int revision = 0;

                BuildVersionInfo buildInfo = new BuildVersionInfo(Arguments.ApplicationKey);
                if (buildInfo.Build == build)
                {
                    revision = buildInfo.Revision + 1;
                }

                buildInfo.Build = build;
                buildInfo.Revision = revision;
                buildInfo.Update();

                version = new Version(manifestVersion.Major, manifestVersion.Minor, build, revision);
                string versionAsString = version.ToString();
                if (versionAsString.Length > 10)
                {
                    string truncatedVersion = versionAsString.Substring(0, 10);
                    Console.WriteLine("{0} contains more than 10 characters, which is not allowed in the Phone manifest. Using {1} for the WMAppManifest.xml", versionAsString, truncatedVersion);
                    versionAttribute.Value = truncatedVersion;
                }
                else
                {
                    versionAttribute.Value = versionAsString;
                }

                return true;
            }
            else
            {
                Console.WriteLine("{0} is not a valid version string.", versionString);
            }

            version = null;
            return false;
        }
        private static bool UpdateVersionAttributeWithLatestVersion(XAttribute versionAttribute, out Version version)
        {
            string versionString = versionAttribute.Value;

            Version manifestVersion;
            bool success = Version.TryParse(versionString, out manifestVersion);
            if (success)
            {
                string yearMonthString = DateTime.Today.ToString("yyMM");
                int build = int.Parse(yearMonthString);

                string dayString = DateTime.Today.ToString("dd");
                int revision = int.Parse(dayString);

                BuildVersionInfo buildInfo = new BuildVersionInfo(Arguments.ApplicationKey);

                if (buildInfo.Build == build && buildInfo.RevisionDay == revision)
                {
                    revision = buildInfo.Revision + 1;
                }
                else
                {
                    revision *= 1000;
                }

                buildInfo.Build = build;
                buildInfo.Revision = revision;
                buildInfo.Update();

                version = new Version(manifestVersion.Major, manifestVersion.Minor, build, revision);
                versionAttribute.Value = version.ToString();
                return true;
            }
            else
            {
                Console.WriteLine("{0} is not a valid version string.", versionString);
            }

            version = null;
            return false;
        }