Files
TaskFlow/app/update_devexpress_refs.py
2026-01-28 21:47:49 +01:00

29 lines
1.0 KiB
Python

import re
vbproj_path = r"TaskFlow\taskFLOW.vbproj"
devexpress_base_path = r"D:\ProgramFiles\DevExpress 21.2\Components\Bin\Framework"
with open(vbproj_path, 'r', encoding='utf-8') as f:
content = f.read()
# Pattern for DevExpress references without HintPath
pattern = r'(<Reference Include="(DevExpress\.[^"]+\.v21\.2[^"]*)"[^>]*>)\s*(<SpecificVersion>False</SpecificVersion>)?\s*(</Reference>)'
def replace_func(match):
full_ref = match.group(1)
dll_name = re.sub(r',.*$', '', match.group(2))
specific_version = match.group(3)
dll_filename = f"{dll_name}.dll"
if specific_version:
return f"{full_ref}\r\n {specific_version}\r\n <HintPath>{devexpress_base_path}\\{dll_filename}</HintPath>\r\n </Reference>"
else:
return f"{full_ref}\r\n <HintPath>{devexpress_base_path}\\{dll_filename}</HintPath>\r\n </Reference>"
new_content = re.sub(pattern, replace_func, content)
with open(vbproj_path, 'w', encoding='utf-8') as f:
f.write(new_content)
print("DevExpress references updated successfully")