以舊版 .NET 為目標 (F#)Target older versions of .NET (F#)

如果您在 Windows 8.1 上安裝了 Visual Studio 時,嘗試於 F# 專案中以 .NET Framework 2.0、3.0 或 3.5 為目標,則可能會出現下列錯誤:The following error might appear if you try to target the .NET Framework 2.0, 3.0, or 3.5 in an F# project when Visual Studio is installed on Windows 8.1:

此專案需要 2.0 的 F# 執行階段,但並未安裝該執行階段。This project requires the 2.0 F# runtime, but that runtime is not installed.

在下列條件組合下,已知會發生此錯誤:This error is known to occur under the following combination of conditions:

  • 在 Windows 8.1 上安裝了 Visual Studio。You installed Visual Studio on Windows 8.1.

  • 在安裝 Visual Studio 之前,未啟用 .NET Framework 3.5。You didn’t enable the .NET Framework 3.5 before you installed Visual Studio.

  • 您的專案以 .NET Framework 2.0、3.0 或 3.5 為目標。Your project targets the .NET Framework 2.0, 3.0, or 3.5.

當您安裝 Visual Studio 時,它會偵測已安裝的 .NET Framework 版本。When you install Visual Studio, it detects the installed versions of the .NET Framework. 只有在已安裝並啟用 .NET Framework 3.5 時,Visual Studio 才會安裝 F# 2.0 執行階段。Visual Studio installs the F# 2.0 runtime only if the .NET Framework 3.5 is installed and enabled.

解決錯誤Resolve the error

若要解決這個錯誤,您可以執行下列其中一項:To resolve this error, you can either:

  • 以較新版本的 .NET Framework 為目標。Target a newer version of the .NET Framework.

  • 在 Windows 8.1 上啟用 .NET Framework 3.5,然後透過修復 Visual Studio 安裝來安裝 F# 2.0 執行階段。Enable the .NET Framework 3.5 on Windows 8.1 and then install the F# 2.0 runtime by repairing the Visual Studio installation. 執行此動作的步驟如下。The steps to do this follow.

在 Windows 8.1 上啟用 .NET Framework 3.5To enable the .NET Framework 3.5 on Windows 8.1

  1. 在 [開始]**** 畫面上鍵入控制台On the Start screen, type Control Panel.

    當您鍵入時,控制台圖示會出現在 [應用程式]**** 標題下方。As you type, the Control Panel icon appears under the Apps heading.

  2. 選擇控制台圖示,選擇程式集圖示,然後選擇 [開啟或關閉 Windows 功能]**** 連結。Choose the Control Panel icon, choose the Programs icon, and then choose the Turn Windows features on or off link.

  3. 確定已選取 [.NET Framework 3.5 (含 .NET 2.0 及 3.0)]**** 核取方塊,然後選擇 [確定]**** 按鈕。Make sure that the .NET Framework 3.5 (includes .NET 2.0 and 3.0) check box is selected, and then choose the OK button. 您不需要為 .NET Framework 選用元件的任何子節點選取核取方塊。You don’t need to select the check boxes for any child nodes for optional components of the .NET Framework.

    如果尚未啟用 .NET Framework 3.5,則會加以啟用。The .NET Framework 3.5 is enabled if it wasn't already.

安裝 F# 2.0 執行階段To install the F# 2.0 runtime

請遵循修復 Visual Studio 的步驟Follow the steps to repair Visual Studio.

另請參閱See also