開始使用 Xbox One 上的 UWP 應用程式開發Getting started with UWP app development on Xbox One

請謹慎依照這些步驟來順利設定您的電腦和 Xbox One 以進行通用 Windows 平台 (UWP) 開發。Carefully follow these steps to successfully set up your PC and Xbox One for Universal Windows Platform (UWP) development. 在您完成設定之後,即可在 Xbox One 上的 UWP 頁面上深入了解 Xbox One 上的開發人員模式,以及建置 UWP App。After you’ve got things set up, you can learn more about Developer Mode on Xbox One and building UWP apps on the UWP for Xbox One page.

在您開始使用 Intune 之前Before you start

開始之前,您需要執行下列動作:Before you start you will need to do the following:

  • 使用最新版本的 Windows 10 來設定電腦。Set up a PC with the latest version of Windows 10.
  • 在 Xbox One 主機上至少有 5 GB 的可用空間。Have at least five gigabytes of free space on your Xbox One console.

設定開發電腦Setting up your development PC

  1. 安裝 Visual Studio 2015 Update 3、Visual Studio 2017 或 Visual Studio 2019。Install Visual Studio 2015 Update 3, Visual Studio 2017, or Visual Studio 2019.

    如果您要安裝 Visual Studio 2015 Update 3,請務必選擇 [ 自訂 安裝],然後選取 [ 通用 Windows 應用程式開發工具 ] 核取方塊-它不是預設安裝的一部分。If you're installing Visual Studio 2015 Update 3, make sure that you choose Custom install and select the Universal Windows App Development Tools check box – it's not part of the default install. 如果您是 C++ 開發人員,請務必選擇 [自訂安裝],並選取 [C++]If you are a C++ developer, make sure that you choose Custom install and select C++.

    如果您要安裝 Visual Studio 2017 或 Visual Studio 2019,請務必選擇 通用 Windows 平臺開發 工作負載。If you're installing Visual Studio 2017 or Visual Studio 2019, make sure that you choose the Universal Windows Platform development workload. 如果您是 c + + 開發人員,請在右側的 [ 摘要 ] 窗格中,于 [ 通用 Windows 平臺開發] 底下,確定您選取 [ c + + 通用 Windows 平臺工具 ] 核取方塊。If you're a C++ developer, in the Summary pane on the right, under Universal Windows Platform development, make sure that you select the C++ Universal Windows Platform tools checkbox. 它不是預設安裝的一部分。It's not part of the default install.

    如需詳細資訊,請參閱 在 Xbox 開發環境上設定 UWPFor more information, see Set up your UWP on Xbox development environment.

  2. 安裝最新的 WINDOWS 10 SDKInstall the latest Windows 10 SDK.

  3. 為開發電腦啟用開發人員模式 (設定/更新 & 安全性/適用于開發人員/使用開發人員功能/開發人員模式) 。Enable Developer Mode for your development PC (Settings / Update & Security / For developers / Use developer features / Developer mode).

現在開發電腦已準備就緒,您可以觀看這段影片或繼續閱讀本文,了解如何設定您的 Xbox One 進行開發,以及建立和部署 UWP app。Now that your development PC is ready, you can watch this video or continue reading to see how to set up your Xbox One for development and create and deploy a UWP app to it.

設定 Xbox One 主機Setting up your Xbox One console

  1. 在 Xbox One上啟用開發人員模式。Activate Developer Mode on your Xbox One. 下載應用程式、取得啟用代碼,然後將它輸入合作夥伴中心應用程式開發人員帳戶中的 [ 管理 Xbox One 主控台 ] 頁面。Download the app, get the activation code, and then enter it into the Manage Xbox One consoles page in your Partner Center app developer account. 如需詳細資訊,請參閱啟用 Xbox One 開發人員模式頁面。For more information, see Xbox One Developer Mode activation.

  2. 開啟 開發模式啟用 應用程式,然後選取 [ 切換並重新啟動]。Open the Dev Mode Activation app and select Switch and restart. 恭喜,您現在已經有處於開發人員模式的 Xbox One 了!Congratulations, you now have an Xbox One in Developer Mode!

注意

您的零售版遊戲和 App 將無法在開發人員模式中執行,但您所建立的 App 或遊戲則可以。Your retail games and apps won’t run in Developer Mode, but the apps or games you create will. 切換回零售模式,以執行您最愛的遊戲和 App。Switch back to Retail Mode to run your favorite games and apps.

注意

在您可以於開發人員模式中將 App 部署到 Xbox One 之前,主機上必須已有使用者登入。Before you can deploy an app to your Xbox One in Developer Mode, you must have a user signed in on the console. 您可以使用現有的 Xbox Live 帳戶,或在開發人員模式中為主機建立一個新帳戶。You can either use your existing Xbox Live account or create a new account for your console in Developer Mode.

在 Visual Studio 中建立您的第一個專案Creating your first project in Visual Studio

如需詳細資訊,請參閱 在 Xbox 開發環境上設定 UWPFor more detailed information, see Set up your UWP on Xbox development environment.

  1. 為 c #:建立新的通用 Windows 專案,然後在方案總管中,以滑鼠右鍵按一下專案,然後選取 [屬性]。For C#: Create a new Universal Windows project, and in the Solution Explorer, right-click the project and select Properties. 選取 [調試程式] 索引標籤,將目標裝置變更為遠端電腦,在 [遠端電腦] 欄位中輸入 Xbox One 主控台的 IP 位址或主機名稱,然後選取 [驗證模式] 下拉式清單中的 [**通用 (未加密的通訊協定]) ** 。Select the Debug tab, change Target device to Remote Machine, type the IP address or hostname of your Xbox One console into the Remote machine field, and select Universal (Unencrypted Protocol) in the Authentication Mode drop-down list.

    您可以透過啟動主機上的開發人員首頁 (位於首頁右側的大型磚),並查看左上角來找到 Xbox One IP 位址。You can find your Xbox One IP address by starting Dev Home on your console (the big tile on the right side of Home) and looking at the top left corner. 如需開發人員首頁的詳細資訊,請參閱 Xbox One 工具簡介For more information about Dev Home, see Introduction to Xbox One tools.

  2. 針對 c + + 和 HTML/JAVAscript 專案:您可以遵循類似 c # 專案的路徑,但在專案屬性中,請移至 [調試程式] 索引標籤,選取 [偵錯工具] 中的 [遠端電腦] 以開啟下拉式清單,在 [電腦名稱稱] 欄位中輸入主控台的 IP 位址或主機名稱,然後選取 [驗證類型] 欄位中的 [ ) (通用For C++ and HTML/Javascript projects: You follow a path similar to C# projects, but in the project properties go to the Debugging tab, select Remote Machine in the Debugger to open the drop-down list, type the IP address or hostname of the console into the Machine Name field, and select Universal (Unencrypted Protocol) in the Authentication Type field.

  3. 在頂端功能表列中,從 [綠色播放] 按鈕左邊的下拉式清單中選取 [ x64 ]。Select x64 from the dropdown to the left of the green play button in the top menu bar.

  4. 按 F5 鍵時,您的 App 將會建置並開始部署到您的 Xbox One 上。When you press F5, your app will build and start to deploy on your Xbox One.

  5. 第一次這樣做時,Visual Studio 會提示您輸入 Xbox One 的 PIN。The first time you do this, Visual Studio will prompt you for a PIN for your Xbox One. 您可以在 Xbox One 上啟動開發人員首頁,然後選取 [ 顯示 Visual Studio 釘 選] 按鈕,來取得 pin。You can get a PIN by starting Dev Home on your Xbox One and selecting the Show Visual Studio pin button.

  6. 配對之後,您的 App 就會開始部署。After you have paired, your app will start to deploy. 第一次這樣做時,處理速度可能會有點慢 (我們必須將所有工具都複製到您的 Xbox),但如果花費的時間超過數分鐘,則可能有發生錯誤。The first time you do this it might be a bit slow (we have to copy all the tools over to your Xbox), but if it takes more than a few minutes, something is probably wrong. 請確定您已依照上述所有步驟進行 (特別您是否有將 [驗證模式] 設為 [通用]?),並且使用有線網路連線來連線到 Xbox One。Make sure that you have followed all of the steps above (particularly, did you set the Authentication Mode to Universal?) and that you are using a wired network connection to your Xbox One.

  7. 請放鬆一下。Sit back and relax. 享受您在主機上執行的第一個 app!Enjoy your first app running on the console!

這樣就完成了!That's it!

Hello World

另請參閱See also