.NET Framework 使用者入門Get started with the .NET Framework

.NET Framework 是執行階段的執行環境,負責管理以 .NET Framework 為目標的應用程式。The .NET Framework is a runtime execution environment that manages apps that target the .NET Framework. 其由通用語言執行平台及廣大的類別庫組成,前者提供記憶體管理和其他系統服務,後者則能讓程式設計人員將強固、可靠的程式碼善用於應用程式開發的所有主要領域。It consists of the common language runtime, which provides memory management and other system services, and an extensive class library, which enables programmers to take advantage of robust, reliable code for all major areas of app development.

注意

.NET Framework 只能在 Windows 系統上使用。The .NET Framework is available on Windows systems only. 您可以在 Windows、MacOS 和 Linux 上使用 .NET Core 來執行應用程式。You can use .NET Core to run apps on Windows, MacOS, and Linux.

什麼是 .NET Framework?What is the .NET Framework?

.NET Framework 是適用於 Windows 的 受控執行環境,可為執行中的應用程式提供多樣的服務。The .NET Framework is a managed execution environment for Windows that provides a variety of services to its running apps. 其由兩個主要元件組成:通用語言執行平台 (CLR) 和 .NET Framework 類別庫,前者是負責處理執行中應用程式的執行引擎,後者提供通過測試、可重複使用的程式碼程式庫,讓開發人員可從自己的應用程式中呼叫。It consists of two major components: the common language runtime (CLR), which is the execution engine that handles running apps, and the .NET Framework Class Library, which provides a library of tested, reusable code that developers can call from their own apps. .NET Framework 提供給執行中應用程式的服務包括:The services that the .NET Framework provides to running apps include the following:

  • 記憶體管理。Memory management. 在許多程式設計語言中,程式設計人員負責配置和釋放記憶體,以及處理物件存留期。In many programming languages, programmers are responsible for allocating and releasing memory and for handling object lifetimes. 在 .NET Framework 應用程式中,CLR 會代表應用程式提供這些服務。In .NET Framework apps, the CLR provides these services on behalf of the app.

  • 一般型別系統。A common type system. 在傳統的程式語言中,基本型別是由編譯器所定義,這會讓跨語言互通性變得很複雜。In traditional programming languages, basic types are defined by the compiler, which complicates cross-language interoperability. 在 .NET Framework 中,基底型別是由 .NET Framework 型別系統所定義,可在所有以 .NET Framework 為目標的語言之間通用。In the .NET Framework, basic types are defined by the .NET Framework type system and are common to all languages that target the .NET Framework.

  • 廣泛類別庫。An extensive class library. 程式設計人員不再需要撰寫大量的程式碼來處理常見的低階程式設計作業,而能夠使用 .NET Framework 類別庫中可立即存取的類型程式庫及其成員來完成這項工作。Instead of having to write vast amounts of code to handle common low-level programming operations, programmers use a readily accessible library of types and their members from the .NET Framework Class Library.

  • 開發架構和技術。Development frameworks and technologies. .NET Framework 包含特定應用程式開發領域所需的程式庫,例如 Web 應用程式所需的 ASP.NET、資料存取所需的 ADO.NET、服務導向應用程式所需的 Windows Communication Foundation,以及 Windows 傳統型應用程式所需的 Windows Presentation Foundation。The .NET Framework includes libraries for specific areas of app development, such as ASP.NET for web apps, ADO.NET for data access, Windows Communication Foundation for service-oriented apps, and Windows Presentation Foundation for Windows desktop apps.

  • 語言互通性。Language interoperability. 以 .NET Framework 為目標的語言編譯器會發出名為通用中間語言 (CIL) 的中繼程式碼,這個程式碼接著會在執行階段由通用語言執行平台進行編譯。Language compilers that target the .NET Framework emit an intermediate code named Common Intermediate Language (CIL), which, in turn, is compiled at runtime by the common language runtime. 有了此功能,使用某一種語言撰寫的常式就能供其他語言存取,而程式設計人員也能使用自己慣用的語言專心建立應用程式。With this feature, routines written in one language are accessible to other languages, and programmers focus on creating apps in their preferred languages.

  • 版本相容性。Version compatibility. 在極少數例外狀況下,使用某一特定 .NET Framework 版本開發的應用程式可不經修改直接在較新的版本上執行。With rare exceptions, apps that are developed by using a particular version of the .NET Framework run without modification on a later version.

  • 並存執行。Side-by-side execution. .NET Framework 允許同一部電腦上存在多個版本的 Common Language Runtime,藉此協助解決版本衝突。The .NET Framework helps resolve version conflicts by allowing multiple versions of the common language runtime to exist on the same computer. 這表示,多個應用程式版本不僅可共存,應用程式也可以建置時使用的 .NET Framework 版本上執行。This means that multiple versions of apps can coexist and that an app can run on the version of the .NET Framework with which it was built. 並存執行適用於.NET Framework 版本群組 1.0/1.1、2.0/3.0/3.5 和 4/4.5.x/4.6.x/4.7.x/4.8。Side-by-side execution applies to the .NET Framework version groups 1.0/1.1, 2.0/3.0/3.5, and 4/4.5.x/4.6.x/4.7.x/4.8.

  • 多目標。Multitargeting. 將目標設為 .NET Standard,開發人員就能建立可在該標準版本所支援的多個 .NET Framework 平台上運作的類別庫。By targeting .NET Standard, developers create class libraries that work on multiple .NET Framework platforms supported by that version of the standard. 例如,以 .NET Standard 2.0 為目標的類別庫,可由目標為 .NET Framework 4.6.1、.NET Core 2.0 和 UWP 10.0.16299 的應用程式使用。For example, libraries that target the .NET Standard 2.0 can be used by apps that target the .NET Framework 4.6.1, .NET Core 2.0, and UWP 10.0.16299.

適用於使用者的 .NET FrameworkThe .NET Framework for users

如果您並未開發而是使用 .NET Framework 應用程式,就不需要具備任何有關 .NET Framework 或其作業的特定知識。If you don't develop .NET Framework apps, but you use them, you aren't required to have specific knowledge about the .NET Framework or its operation. 大致上,.NET Framework 對使用者而言是完全不存在的。For the most part, the .NET Framework is completely transparent to users.

如果您使用的是 Windows 作業系統,您的電腦上可能已經安裝了 .NET Framework。If you're using the Windows operating system, the .NET Framework may already be installed on your computer. 此外,如果您安裝的應用程式需要 .NET Framework,應用程式的安裝程式可能會在您的電腦上安裝特定的 .NET Framework 版本。In addition, if you install an app that requires the .NET Framework, the app's setup program might install a specific version of the .NET Framework on your computer. 在某些情況下,您可能會看到對話方塊,要求您安裝 .NET Framework。In some cases, you may see a dialog box that asks you to install the .NET Framework. 如果在出現這個對話方塊時您剛好嘗試執行應用程式,而且電腦也可以存取網際網路,則可以前往網頁安裝缺少的 .NET Framework 版本。If you've just tried to run an app when this dialog box appears and if your computer has Internet access, you can go to a webpage that lets you install the missing version of the .NET Framework. 如需詳細資訊,請參閱安裝指南For more information, see the Installation guide.

一般而言,您不應該將電腦上已安裝的 .NET Framework 版本解除安裝。In general, you shouldn't uninstall versions of the .NET Framework that are installed on your computer. 不這麼做的原因有兩個:There are two reasons for this:

  • 如果您使用的應用程式使用特定版本的 .NET Framework,移除該版本可能會造成應用程式無法執行。If an app that you use depends on a specific version of the .NET Framework, that app may break if that version is removed.

  • 有些 .NET Framework 版本是舊版的就地更新。Some versions of the .NET Framework are in-place updates to earlier versions. 例如,.NET Framework 3.5 是 2.0 版的就地更新,而 .NET Framework 4.8 是 4 到 4.7.2 版的就地更新。For example, the .NET Framework 3.5 is an in-place update to version 2.0, and the .NET Framework 4.8 is an in-place update to versions 4 through 4.7.2. 如需詳細資訊,請參閱 .NET Framework 版本和相依性For more information, see .NET Framework Versions and Dependencies.

在 Windows 8 之前的 Windows 版本中,如果選擇移除 .NET Framework,請一律使用 [控制台] 中的 [程式和功能] 將它解除安裝。On Windows versions before Windows 8, if you do choose to remove the .NET Framework, always use Programs and Features from Control Panel to uninstall it. 請勿手動移除任何 .NET Framework 版本。Never remove a version of the .NET Framework manually. 在 Windows 8 (含) 以上版本中,.NET Framework 是作業系統元件,無法單獨解除安裝。On Windows 8 and above, the .NET Framework is an operating system component and cannot be independently uninstalled.

請注意,多個 .NET Framework 版本可以同時在單一電腦上並存。Note that multiple versions of the .NET Framework can coexist on a single computer at the same time. 這表示,您不需要解除安裝舊版,就可以直接安裝新版。This means that you don't have to uninstall previous versions in order to install a later version.

適用於開發人員的 .NET FrameworkThe .NET Framework for developers

如果您是開發人員,可以選擇任何支援 .NET Framework 的程式設計語言來建立應用程式。If you're a developer, choose any programming language that supports the .NET Framework to create your apps. 由於 .NET Framework 提供語言獨立性和互通性,因此不論開發時使用的語言為何,您都可以與其他 .NET Framework 應用程式和元件互動。Because the .NET Framework provides language independence and interoperability, you interact with other .NET Framework apps and components regardless of the language with which they were developed.

若要開發 .NET Framework 應用程式或元件,請執行下列步驟:To develop .NET Framework apps or components, do the following:

  1. 如果未在作業系統上預先安裝,請安裝要當成應用程式目標的 .NET Framework 版本。If it's not preinstalled on your operating system, install the version of the .NET Framework that your app will target. 最近的生產版本是 .NET Framework 4.8。The most recent production version is the .NET Framework 4.8. 它已預先安裝在 Windows 10 May 2019 Update 上,在舊版 Windows 作業系統上則必須自行下載。It is preinstalled on Windows 10 May 2019 Update, and it is available for download on earlier versions of the Windows operating system. 如需 .NET Framework 系統需求,請參閱系統需求For .NET Framework system requirements, see System Requirements. 如需安裝其他 .NET Framework 版本的資訊,請參閱安裝指南For information on installing other versions of the .NET Framework, see Installation Guide. 其他.NET Framework 套件會在頻外發行,也就是在任何定期或排程發行週期以外輪流發行。Additional .NET Framework packages are released out of band, which means that they're released on a rolling basis outside of any regular or scheduled release cycle. 如需這些套件的資訊,請參閱 .NET Framework 和不定期發行For information about these packages, see The .NET Framework and Out-of-Band Releases.

  2. 選取您要用來開發應用程式且 .NET Framework 也支援的語言。Select the language or languages supported by the .NET Framework that you intend to use to develop your apps. 有多種語言可供選擇,包括 Microsoft 的 Visual BasicC#F#C++/CLIA number of languages are available, including Visual Basic, C#, F#, and C++/CLI from Microsoft. (可讓您開發 .NET Framework 應用程式的程式設計語言會遵循通用語言基礎結構 (CLI) 規格)。(A programming language that allows you to develop apps for the .NET Framework adheres to the Common Language Infrastructure (CLI) specification.)

  3. 選取並安裝要用來建立應用程式,且支援所選程式設計語言的開發環境。Select and install the development environment to use to create your apps and that supports your selected programming language or languages. 適用於 .NET Framework 應用程式的 Microsoft 整合式開發環境 (IDE) 為 Visual StudioThe Microsoft integrated development environment (IDE) for .NET Framework apps is Visual Studio. 並有多個版本可供使用。It's available in a number of editions.

如需開發以 .NET Framework 為目標之應用程式的詳細資訊,請參閱開發指南For more information on developing apps that target the .NET Framework, see the Development Guide.

標題Title 說明Description
概觀Overview 替建置以 .NET Framework 為目標之應用程式的開發人員提供詳細資訊。Provides detailed information for developers who build apps that target the .NET Framework.
安裝指南 (英文)Installation guide 提供安裝 .NET Framework 的相關資訊。Provides information about installing the .NET Framework.
.NET Framework 和不定期發行The .NET Framework and Out-of-Band Releases 描述 .NET Framework 的頻外發行以及如何將其運用在您的應用程式中。Describes the .NET Framework out of band releases and how to use them in your app.
系統需求System Requirements 列出執行 .NET Framework 的硬體與軟體需求。Lists the hardware and software requirements for running the .NET Framework.
.NET Core 和開放原始碼.NET Core and Open-Source 描述 .NET Core 的相關 .NET Framework 功能,以及如何存取開放原始碼 .NET Core 專案。Describes .NET Core in relation to the .NET Framework and how to access the open-source .NET Core projects.
.NET Core 文件.NET Core documentation 提供適用於 .NET Core 的概念性及 API 參考文件。Provides the conceptual and API reference documentation for .NET Core.
.NET Standard.NET Standard 討論 .NET Standard,這是個別 .NET 實作支援的版本化規格,以保證在多個平台上都能使用一組一致的 API。Discusses .NET Standard, a versioned specification that individual .NET implementations support to guarantee that a consistent set of APIs are available on multiple platforms.

另請參閱See also