Hello World On Windows
On This Page
This document describes how to get started with continuous integration on Windows execution environments on CircleCI. If this is your first time setting up CircleCI, we recommend checking out the Getting Started guide.
To follow along with this document you will need:
Let us consider a more advanced (but still introductory) “hello world” application using the Windows executor. This example application still prints “Hello World” to the console, but does so using .NET core to create an executable, uses dependency caching, and creates an artifact on every build.
You can view the entire configuration here. It also includes browser and UI testing, but we will focus on the
hello-world workflow for now.
orbs: win: email@example.com
Next, we declare orbs that we will be using in our build. We will only use the Windows orb to help us get started. This example uses the 2.4.0 version of the orb, but you may consider using a more recent version.
workflows: hello-world: jobs: - build
We define a
hello-world workflow, in which we run a single job named
jobs: build: executor: name: win/default
jobs key, we define the
build job, and set the executor via the orb we are using.
steps: - checkout
In our first step, we run the
checkout command to pull our source code from our version control system.
- restore_cache: keys: - run: name: "Install project dependencies" command: dotnet.exe restore - save_cache: paths: - C:\Users\circleci\.nuget\packages
Next in the config, we make use of caching to restore cached dependencies from previous builds. The command
dotnet restore will fetch any dependencies that are not already installed/restored from the cache. Learn more about caching in our caching document.
- run: name: "Run Build step" command: dotnet.exe publish -c Release -r win10-x64 - run: name: "Test the executable" command: .\bin\Release\netcoreapp2.1\win10-x64\publish\circleci-demo-windows.exe
Next, we run two steps: one to build the executable for Windows 10, and another to test the executable (expecting to see “Hello World” printed to the console).
- store_artifacts: path: .\bin\Release\netcoreapp2.1\win10-x64\publish\circleci-demo-windows.exe
In our last step, we store the build executable as an artifact, making it accessible with the CircleCI web application or API.
Consider reading documentation on some of CircleCI’s features:
- See the Concepts document for a summary of configuration and the hierarchy of top-level keys in a .circleci/config.yml file.
- Refer to the Workflows document for examples of orchestrating job runs with concurrent, sequential, scheduled, and manual approval workflows.
- Find complete reference information for all keys and pre-built Docker images in the Configuring CircleCI and CircleCI Images documentation, respectively.
Help make this document better
This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.
- Suggest an edit to this page (please read the contributing guide first).
- To report a problem in the documentation, or to submit feedback and comments, please open an issue on GitHub.
- CircleCI is always seeking ways to improve your experience with our platform. If you would like to share feedback, please join our research community.
Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.
You can also visit our support site to find support articles, community forums, and training resources.
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.