# -*- coding: utf-8 -*- """把 csproj 里 Smart.CustomComponents 的 HintPath 从安装目录改指仓库 bin(最新构建)。""" import io P = r"C:\Users\099978\Documents\SharpDevelop Projects\成套报价软件\成套报价软件\成套报价软件.csproj" OLD = r"..\..\..\..\..\..\Program Files %28x86%29\SharpDevelop\5.2\bin\Smart.CustomComponents.dll" NEW = r"F:\Visual Studio\1\33\SharpDevelop-master\bin\Smart.CustomComponents.dll" s = io.open(P, encoding="utf-8-sig").read() assert OLD in s, "旧 HintPath 未找到" io.open(P, "w", encoding="utf-8-sig").write(s.replace(OLD, NEW)) print("HintPath 已指向仓库 bin(最新构建)")