複製專案成新專案 (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

空中聖經學院_詩篇_鍾平貴老師 (播放清單)



手機、平板用戶,請點擊 YouTube 空中聖經學院_詩篇_鍾平貴老師 (播放清單)

解除 NuGet 錯誤,@ Visual Studio 2012

當安裝好 Visual Studio 2012 後,第一次創建 Web 專案,無論是 ASP.NET Win Form 或是 ASP.NET MVC,都會產生運行錯誤:

"Error: this template attempted to load component assembly 'NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.".

 

要解除這個問題,可以下列步驟進行:

  1. 啟動 Visual studio 2012,點選 Tools -> Extension & Updates
  2. 選取 Online

    image

  3. 選取清單中的 NuGet Package Manager,並按下 Download。
  4. 下載完成後,系統會詢問是否要安裝 VSIXInstall.exe,請執行安裝。
  5. 重啟 Visual studio 2012。

空中主日學_屬靈生命的擴張_張路加牧師 (播放清單)



手機、平板用戶,請點擊 YouTube 空中主日學_屬靈生命的擴張_張路加牧師 (播放清單)

從 開始>執行,你可以使用那些控制台指令? (Start > Run)

使用Windows的人,一定知道什麼是 開始。但是知道 執行 的人,可能就相較少了許多。

首先,要知道的基本知識:可以執行的指令,一定是【可執行檔】,而且這些【可執行檔】一定貯存在 系統環境變數 PATH 的路徑中。

【可執行檔】:是指附檔名為 *.bat, *.com, *.exe 的檔案,這類型的檔案是可執行的。

系統環境變數 PATH:凡是在 PATH 變數中,增設的路徑,都可以成為找尋可執行檔是否存在的依據。


接下來,就是可以使用那些控制台指令?他們各有什麼功用?什麼 控制台 (.cpl) 檔案?

檔名 用途
Access.cpl 協助工具內容
Appwiz.cpl 新增/移除程式內容
bthprops.cpl Bluetooth裝置
collab.cpl 近端分享
Desk.cpl 顯示內容
FindFast.cpl FindFast (隨附於 Microsoft Office for Windows 95)
Firewall.cpl Windows 防火牆
hdwwiz.cpl 裝置管理員
igfxcpl.cpl Intel圖形和媒體控制台
Inetcpl.cpl 網際網路內容
infocardcpl.cpl  
Intl.cpl 地區設定內容
irprops.cpl Infrared properties control panel file
Joy.cpl 搖桿內容
Main.cpl 滑鼠、字型、鍵盤和印表機內容
Mlcfg32.cpl Microsoft Exchange 或 Windows Messaging 內容
Mmsys.cpl 多媒體內容
Modem.cpl 數據機內容
ncpa.cpl 網路連線
Netcpl.cpl 網路內容
Odbccp32.cpl 資料來源 (32 位元 ODBC,隨附於 Microsoft Office)
Password.cpl 密碼內容
powercfg.cpl 電源選項
RTSnMg64.cpl 瑞昱高傳真音效
Sticpl.cpl 掃描器與數位相機內容
Sysdm.cpl 系統內容與新增硬體精靈
TabletPC.cpl 手寫筆與觸控
telephon.cpl 電話、數據機的位置資訊
Themes.cpl 桌面主題
TimeDate.cpl 日期/時間內容
Wgpocpl.cpl Microsoft Mail 郵局
wscui.cpl 行動作業中心

PowerShell Snapin (嵌入式管理單元)

PowerShell Snapin (嵌入式管理單元),內建有七種。若有需要可再以外掛方式來增加。

內建的七種單元:

  • Microsoft.PowerShell.Diagnostics
    這個 Windows PowerShell 嵌入式管理單元包含 Windows Eventing 及 效能計數器 Cmdlet。
  • Microsoft.WSMan.Management
    這個 PS 嵌入式管理單元包含 Cmdlet (例如 WSManInstance 和 Set-WSManInstance),Windows PowerShell 主機會使用這些 Cmdlet 管理 WsMan 作業。
  • Microsoft.PowerShell.Core
    這個 Windows PowerShell 嵌入式管理單元包含用於管理 Windows PowerShell 元件的 Cmdlet。
  • Microsoft.PowerShell.Utility
    這個 Windows PowerShell 嵌入式管理單元包含用於操控資料的公用程式 Cmdlet。
  • Microsoft.PowerShell.Host
    這個 Windows PowerShell 嵌入式管理單元包含供 Windows PowerShell 主控台主機使用的 Cmdlet (例如 Start-Transcript 和 Stop-Transcript )。
  • Microsoft.PowerShell.Management
    這個 Windows PowerShell 嵌入式管理單元包含用於管理 Windows 元件的管理 Cmdlet。
  • Microsoft.PowerShell.Security
    這個 Windows PowerShell 嵌入式管理單元包含用來管理 Windows PowerShell 安全性的 Cmdlet。

上述單元內容,可執行 Get-PSSnapin 得知。

 

若是要增加,使用指令:Add-PSSnapin
    Add-PSSnapin SqlServerProviderSnapin100
    Add-PSSnapin SqlServerCmdletSnapin100

若是要移除,使用指令:Move-PSSnapin
    Move-PSSnapin SqlServerProviderSnapin100
    Move-PSSnapin SqlServerCmdletSnapin100

可執行 Get-PSSnapin –Registered 得知,目前所有外掛的 Snapin 有哪些?

使用 T-SQL 深入了解 SQL Server 的基本資料

EXECUTE xp_regread @rootkey='HKEY_LOCAL_MACHINE',
                   @key='SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL',
                   @value_name='MSSQLSERVER'

Value Data
MSSQLSERVER MSSQL10_50.MSSQLSERVER

 

可使用 SELECT SERVERPROPERTY() 得到 Server 的相關資料。
如:

  • SELECT SERVERPROPERTY('ServerName')
  • SELECT SERVERPROPERTY('InstanceName')
  • SELECT SERVERPROPERTY('productversion')
  • SELECT SERVERPROPERTY ('productlevel')
  • SELECT SERVERPROPERTY ('edition')
  • GC-IT-N01
  • NULL
  • 10.50.1600.1
  • RTM
  • Standard Edition (64-bit)
  • SELECT @@servername
  • SELECT @@VERSION
  • GC-IT-N01
  • Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)   Apr  2 2010 15:48:46   Copyright (c) Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)

 

SELECT SERVERPROPERTY('InstanceName') 的資料,來自於:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

 

SELECT SERVERPROPERTY('productversion') 的資料,來自於:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\ClientSetup\CurrentVersion

 

SQL Server Instances

In order to really understand what versions of SQL Server are installed, you have to understand SQL Server Instances. Each instance of SQL Server operates independently and contains its own collection of databases and settings. There are two types of instances:

Default Instance a single instance named MSSQLSERVER. You connect to this instance using only the server name (ex: localhost)
Named Instance one or more instances. You connect to these instances uing the server name + instance name (ex: localhost\SQLEXPRESS)

 

It's possible have only one instance installed on your machine. But it's also possible to have many instances. And each of those instances could be a different version of SQL Server!

To understand your scenario, use the SQL Server Configuration Manager tool that installs with both SQL Server 2005 and 2008.
On the start menu, expand the "Microsoft SQL Server [YOURVERSION]" menu, and then expand the "Configuration Tools" submenu. Launch the SQL Server Configuration Manager tool.
Here is a screen shot to use as an example:

image

點選右側 SQL Server (MSSQLSERVER) 選項後,按右鍵/內容,可以看到如下結果:

image

 

對於軟體版本的進一步訊息,可參考

 

更多資訊可參考:
http://technet.microsoft.com/en-us/library/ms174396.aspx
http://learningsqlserver.wordpress.com/2011/01/21/what-version-of-sql-server-do-i-have/
SQLSecurity.com http://www.sqlsecurity.com/faqs-1/sql-server-versions/2008-r2