Ejemplo n.º 1
0
    protected override void OnTargetStart(string target)
    {
        if (VersionSuffix.IsNullOrEmpty() && !CustomVersionSuffix.IsNullOrEmpty())
        {
            //module.manifest
            if (IsModule)
            {
                var manifest = ModuleManifest.Clone();
                manifest.VersionTag = CustomVersionSuffix;
                using (var writer = new Utf8StringWriter())
                {
                    XmlSerializer xml = new XmlSerializer(typeof(ModuleManifest));
                    xml.Serialize(writer, manifest);
                    File.WriteAllText(ModuleManifestFile, writer.ToString(), Encoding.UTF8);
                }
            }

            //directory.Build.Props
            var xmlDoc = new XmlDocument()
            {
                PreserveWhitespace = true
            };
            xmlDoc.LoadXml(File.ReadAllText(DirectoryBuildPropsPath));
            var suffix = xmlDoc.GetElementsByTagName("VersionSuffix");
            suffix[0].InnerText = CustomVersionSuffix;
            using (var writer = new Utf8StringWriter())
            {
                xmlDoc.Save(writer);
                File.WriteAllText(DirectoryBuildPropsPath, writer.ToString());
            }
        }
        base.OnTargetStart(target);
    }
Ejemplo n.º 2
0
 public Version(int major, int minor, int patch, int revision, VersionSuffix suffix)
 {
     Major    = major;
     Minor    = minor;
     Patch    = patch;
     Revision = revision;
     Suffix   = suffix;
 }