Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
AssemblyInfo.cs update version info
def set_package_version(manifest_file, target_version):
from xml.etree import ElementTree as et
et.register_namespace("", "")
et.register_namespace("uap", "")
tree = et.parse(manifest_file)
e = tree.find('{}Identity')
e.attrib['Version'] = target_version
tree.write(manifest_file, xml_declaration=True, encoding='utf-8')
import re
import sys
def set_version(infocs, target_version):
if not infocs or not target_version:
raise Exception('invalid param')
with open(infocs, "r+") as f:
assemblyinfo_cs =
pattern_1 = re.compile(r'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', re.MULTILINE)
pattern_2 = re.compile(r'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', re.MULTILINE)
sub1 = r'AssemblyVersion("{}")'.format(target_version)
sub2 = r'AssemblyFileVersion("{}")'.format(target_version)
phase_1 = re.sub(pattern_1, sub1, assemblyinfo_cs)
phase_2 = re.sub(pattern_2, sub2, phase_1)

This comment has been minimized.

Copy link
Owner Author

@heejune heejune commented Sep 22, 2017

  1. - Change the version info string inside the AssemblyInfo.cs file
  2. - Change the version of the deployment package, which is located in Package.appxmanifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.