TrilonIO / aspnetcore-Vue-starter

*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.22k stars 266 forks source link

Powershell script to rename the project to something different #55

Open keithn opened 7 years ago

keithn commented 7 years ago

JustJust in case anyone needs it...

put the following into something like renameProject.ps1, then put it in the root directory of the project then just do ./renameProject.ps1 NextBigThing

Note the script will modify itself so you can rename it again if need be.

param(
[string]$projectName
)

$files = Get-ChildItem . *.* -rec -Attributes !D
foreach ($file in $files)
{
    (Get-Content $file.PSPath) |  Foreach-Object { $_ -replace "Vue2Spa", $projectName } |  Set-Content $file.PSPath
}
Rename-Item .\Vue2Spa.csproj $projectName".csproj"
Rename-Item .\Vue2Spa.sln $projectName".sln"
Nordes commented 6 years ago

Does it also update the namespaces within the c# files (just asking).

SuperJMN commented 6 years ago

You can create the project with dotnet new vuejs -n YourName. It's a standard way to give name to your projected based on a template.