部署 .NET Framework 和應用程式Deploying the .NET Framework and Applications

本文將協助您開始在應用程式上部署 .NET Framework。This article helps you get started deploying the .NET Framework with your application. 大部分資訊的目標對象是開發人員、OEM 和企業系統管理員。Most of the information is intended for developers, OEMs, and enterprise administrators. 想要在電腦上安裝 .NET Framework 的使用者應閱讀安裝 .NET FrameworkUsers who want to install the .NET Framework on their computers should read Installing the .NET Framework.

主要部署資源Key Deployment Resources

使用下列連結連接至其他 MSDN 主題,了解有關 .NET Framework 部署和服務的特定資訊。Use the following links to other MSDN topics for specific information about deploying and servicing the .NET Framework.

安裝和部署Setup and deployment

服務Servicing

簡化部署的功能Features That Simplify Deployment

.NET Framework 提供了一些基本功能,讓部署應用程式更為容易:The .NET Framework provides a number of basic features that make it easier to deploy your applications:

  • 不受影響的應用程式。No-impact applications.

    這項功能提供應用程式隔離,並排除 DLL 衝突。This feature provides application isolation and eliminates DLL conflicts. 根據預設,元件不會影響其他應用程式。By default, components do not affect other applications.

  • 預設為私用元件。Private components by default.

    根據預設,元件會部署到應用程式目錄,並且只有對包含的應用程式為可見的。By default, components are deployed to the application directory and are visible only to the containing application.

  • 受控制的程式碼共用。Controlled code sharing.

    程式碼共用需要您明確地將程式碼設定為共用,而不是使用預設行為。Code sharing requires you to explicitly make code available for sharing instead of being the default behavior.

  • 並存版本。Side-by-side versioning.

    元件或應用程式的多個版本可以共存,您可以選擇要使用哪個版本,而且 Common Language Runtime 會強制執行版本原則。Multiple versions of a component or application can coexist, you can choose which versions to use, and the common language runtime enforces versioning policy.

  • XCOPY 部署和複寫。XCOPY deployment and replication.

    自我描述和獨立的元件和應用程式不需登錄項目或相依性即可部署。Self-described and self-contained components and applications can be deployed without registry entries or dependencies.

  • 動態更新。On-the-fly updates.

    系統管理員可以使用主應用程式 (例如 ASP.NET) 來更新程式 DLL,甚至是在遠端電腦上。Administrators can use hosts, such as ASP.NET, to update program DLLs, even on remote computers.

  • 與 Windows Installer 整合Integration with the Windows Installer.

    部署您的應用程式時,通告、發行、修復和隨選安裝全部都可以使用。Advertisement, publishing, repair, and install-on-demand are all available when deploying your application.

  • 企業部署。Enterprise deployment.

    這項功能可讓您輕鬆散發軟體,包括使用 Active Directory。This feature provides easy software distribution, including using Active Directory.

  • 下載和快取。Downloading and caching.

    累加下載會維持較小的下載,而且會隔離元件,僅供對部署影響較小的應用程式使用。Incremental downloads keep downloads smaller, and components can be isolated for use only by the application for low-impact deployment.

  • 部分信任的程式碼Partially trusted code.

    識別的依據是程式碼而非使用者,而且不會出現憑證對話方塊。Identity is based on the code instead of the user, and no certificate dialog boxes appear.

封裝和散發 .NET Framework 應用程式Packaging and Distributing .NET Framework Applications

文件的其他章節將說明 .NET Framework 的一些封裝和部署資訊。Some of the packaging and deployment information for the .NET Framework is described in other sections of the documentation. 那些小節針對下列內容提供相關資訊:稱為組件的自我描述單位 (不需要登錄項目)、強式名稱的組件 (能確保名稱唯一性並防止名稱冒用),以及組件版本控制 (能處理許多與 DLL 衝突相關的問題)。Those sections provide information about the self-describing units called assemblies, which require no registry entries, strong-named assemblies, which ensure name uniqueness and prevent name spoofing, and assembly versioning, which addresses many of the problems associated with DLL conflicts. 下列章節提供封裝和散發 .NET Framework 應用程式的相關資訊。The following sections provide information about packaging and distributing .NET Framework applications.

封裝Packaging

.NET Framework 提供下列封裝應用程式的選項:The .NET Framework provides the following options for packaging applications:

  • 當做單一組件或組件集合。As a single assembly or as a collection of assemblies.

    使用這個選項時,您會直接依建置時原狀使用 .dll 或 .exe 檔。With this option, you simply use the .dll or .exe files as they were built.

  • 當做封包 (CAB) 檔案。As cabinet (CAB) files.

    使用這個選項時,您會將檔案壓縮成 .cab 檔,讓散發或下載較不費時。With this option, you compress files into .cab files to make distribution or download less time consuming.

  • 當做 Windows Installer 套件或採用其他安裝程式的格式。As a Windows Installer package or in other installer formats.

    使用這個選項時,您將會建立搭配 Windows Installer 使用的 .msi 檔,或封裝您的應用程式以搭配另一個安裝程式使用。With this option, you create .msi files for use with the Windows Installer, or you package your application for use with some other installer.

散發Distribution

.NET Framework 提供下列散發應用程式的選項:The .NET Framework provides the following options for distributing applications:

  • 使用 XCOPY 或 FTP。Use XCOPY or FTP.

    由於 Common Language Runtime 應用程式是自我描述且不需要登錄項目,因此您可以使用 XCOPY 或 FTP 直接將應用程式複製到適當的目錄。Because common language runtime applications are self-describing and require no registry entries, you can use XCOPY or FTP to simply copy the application to an appropriate directory. 接著便可從該目錄執行應用程式。The application can then be run from that directory.

  • 使用程式碼下載。Use code download.

    如果您正在網際網路上或透過公司內部網路散發應用程式,您可以直接將程式碼下載到電腦,並在電腦上執行應用程式。If you are distributing your application over the Internet or through a corporate intranet, you can simply download the code to a computer and run the application there.

  • 使用安裝程式,例如 Windows Installer 2.0。Use an installer program such as Windows Installer 2.0.

    Windows Installer 2.0 可以在全域組件快取和私人目錄中安裝、修復或移除 .NET Framework 組件。Windows Installer 2.0 can install, repair, or remove .NET Framework assemblies in the global assembly cache and in private directories.

安裝位置Installation Location

若要決定應用程式的組件應該部署在哪裡,使執行階段能夠找到它們,請參閱執行階段如何找出組件To determine where to deploy your application's assemblies so they can be found by the runtime, see How the Runtime Locates Assemblies.

安全性考量也可能影響您部署應用程式的方式。Security considerations can also affect how you deploy your application. 在對 Managed 程式碼授與安全性權限時,依據的是程式碼的位置。Security permissions are granted to managed code according to where the code is located. 如果將應用程式或元件部署到信任度極低的位置 (例如網際網路),應用程式或元件所能執行的工作則會受限。Deploying an application or component to a location where it receives little trust, such as the Internet, limits what the application or component can do. 如需部署和安全性考量的詳細資訊,請參閱程式碼存取安全性的基本概念For more information about deployment and security considerations, see Code Access Security Basics.

標題Title 說明Description
執行階段如何找出組件How the Runtime Locates Assemblies 描述 Common Language Runtime 如何決定要用哪個組件來實現繫結要求。Describes how the common language runtime determines which assembly to use to fulfill a binding request.
組件載入的最佳做法Best Practices for Assembly Loading 討論如何避免發生可能造成 InvalidCastExceptionMissingMethodException 和其他錯誤之類型識別的問題。Discusses ways to avoid problems of type identity that can lead to InvalidCastException, MissingMethodException, and other errors.
在 .NET Framework 4.5 安裝期間減少系統重新啟動的次數Reducing System Restarts During .NET Framework 4.5 Installations 描述可防止在任何可能的情況下重新開機的重新啟動管理員,並說明安裝 .NET Framework 的應用程式如何利用 .NET Framework。Describes the Restart Manager, which prevents reboots whenever possible, and explains how applications that install the .NET Framework can take advantage of it.
系統管理員部署手冊Deployment Guide for Administrators 說明系統管理員如何使用 System Center Configuration Manager (SCCM),在整個網路上部署 .NET Framework 及其系統相依性。Explains how a system administrator can deploy the .NET Framework and its system dependencies across a network by using System Center Configuration Manager (SCCM).
開發人員部署手冊Deployment Guide for Developers 說明開發人員如何將 .NET Framework 隨使用者的應用程式安裝在其電腦上。Explains how developers can install .NET Framework on their users' computers with their applications.
部署應用程式、服務和元件Deploying Applications, Services, and Components 討論 Visual Studio 中的部署選項,包括使用 ClickOnce 和 Windows Installer 技術發行應用程式的指示。Discusses deployment options in Visual Studio, including instructions for publishing an application using the ClickOnce and Windows Installer technologies.
發行 ClickOnce 應用程式Publishing ClickOnce Applications 描述如何封裝 Windows Forms 應用程式,並使用 ClickOnce 將它部署到網路上的用戶端電腦。Describes how to package a Windows Forms application and deploy it with ClickOnce to client computers on a network.
封裝和部署資源Packaging and Deploying Resources 描述 .NET Framework 用來封裝及部署資源的中樞和輪輻模型;內容涵蓋資源命名慣例、後援程序和封裝替代方式。Describes the hub and spoke model that the .NET Framework uses to package and deploy resources; covers resource naming conventions, fallback process, and packaging alternatives.
部署 Interop 應用程式Deploying an Interop Application 描述如何交付及安裝 Interop 應用程式,這類應用程式通常包含 .NET Framework 用戶端組件、代表各種不同 COM 類型程式庫的一或多個 Interop 組件,以及一或多個已註冊的 COM 元件。Explains how to ship and install interop applications, which typically include a .NET Framework client assembly, one or more interop assemblies representing distinct COM type libraries, and one or more registered COM components.
如何:取得 .NET Framework 4.5 安裝程式的進度How to: Get Progress from the .NET Framework 4.5 Installer 描述如何以無訊息模式啟動並追蹤 .NET Framework 安裝程序,並同時顯示您自己的安裝進度檢視。Describes how to silently launch and track the .NET Framework setup process while showing your own view of the setup progress.

另請參閱See also