wpf程序文件更改项目名称

使用场景:可以用于更改wpf程序文件的项目名称和程序内的命名空间(适用多个项目)

1、管理者模式打开PowerShell(win+x->PowerShell管理员),然后跳转到所在文件下,输入以下命令,
作用是将该文件夹下所有文件夹和文件的名称中包含的old替换为new。

$root='.'; $from='old'; $to='new'; $p=[regex]::Escape($from)
Get-ChildItem -LiteralPath $root -Recurse -File |
%{ $n=$.Name -replace $p,$to; if($n -ne $.Name){ Rename-Item -LiteralPath $.FullName -NewName $n } }
Get-ChildItem -LiteralPath $root -Recurse -Directory | Sort-Object FullName -Descending |
%{ $n=$
.Name -replace $p,$to; if($n -ne $.Name){ Rename-Item -LiteralPath $.FullName -NewName $n } }

2、使用notepad++的文件查找功能,进行程序内的文本替换,选择项目所在文件夹,分别输入 “查找目标” 和 “替换为” 后,点击“在文件中替换”。

image

posted @ 2026-01-28 15:21  我亦飘零1324  阅读(26)  评论(0)    收藏  举报