複製專案成新專案 (Visual Studio 2012)

實務工作中,常需要以某個舊專案為基礎,來生成新的專案內容。此時,採用複製舊有專案成新專案的方式,是個不錯的選項。


相關的處理步驟,如下:

  1. 複製舊有專案所在之文件夾,以建制成新的文件夾。如 Ch03_00 => Ch03_003
  2. 修改專案檔名及文件夾名稱。
    image      image
  3. 修改專案檔的內容。( ** 只改 文件夾 的名稱 )
    image
  4. 點擊專案檔名,並開啟此一新專案。
  5. 在 Solution Explorer 中,首先修改 專案名稱。
    image
  6. 修改專案的內容。Assembly name, Default namespace
    image
  7. 一次性修正整個專案的特定文字字串。
    image
  8. 刪除專案 bin 目錄中 的舊有專案的檔案。
    image
  9. 若是該專案具有資料庫的功能,記得要修正資料庫的檔案名稱。
    * 在專案文件夾下 Ch03_003\App_Data
    原有檔名:
    aspnet-Ch03_00-20141030232110.mdf
    aspnet-Ch03_00-20141030232110_log.ldf
  10. 修正後的檔名:
    aspnet-Ch03_003-20141030232110.mdf
    aspnet-Ch03_003-20141030232110_log.ldf


** 項次8,一定要處理。否則會有執行錯誤。
Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.


The request for 'Home' has found the following matching controllers:
Ch03_00.Controllers.HomeController
Ch03_003.Controllers.HomeController

沒有留言: