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'(]*>)\s*(False)?\s*()' 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 {devexpress_base_path}\\{dll_filename}\r\n " else: return f"{full_ref}\r\n {devexpress_base_path}\\{dll_filename}\r\n " 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")