Nano Server Developer Experience and Tools

This blog post is now obsolete. Please go to the new blog post here:


Nano Server represents a great opportunity for applications to get the most of available resources and deliver customers an agile environment which supports a DevOps management model.  In order for applications to do this, they need to remove references to components not delivered in Nano Server (this typically means APIs which bring in the GUI or 32 bit references).

To make developing and porting apps to Nano Server easy, we added “decorations” to the Windows header files to include the right APIs, and created a Visual Studio template which leverages this header decoration work, and automates the inclusion of the right headers and libraries. You can enjoy full IntelliSense and error squiggles support.

Thanks to the amazing Visual Studio Debugger team, the Nano Server developer experience includes full remote debugging from Visual Studio!

To automate some of the mundane tasks, we also included a small PowerShell module to make it easy to install the debugger binaries on the Nano Server machine, as well as start & stop the debugger.


  1. On your development machine, you should be running the latest version of PowerShell, i.e. Windows 10, a preview release of Windows Server 2016, or the latest version of the Windows Management Framework.

  2. Make sure your development machine is running Hyper-V, if you’re going to run Nano Server in a VM.  Otherwise, make sure that your development machine has network access to your Nano Server machine.

  3. Install the RTM version of Visual Studio (the version released on July 29). Here’s a link to download the free community version of Visual Studio.  Make sure to choose “Custom” install, and under “Universal Windows App Development Tools”, ensure that “Tools and Windows SDK 10…” is checked.

  4. Download the zip file attached to this blog and unzip it:
    1. Double-click on NanoServerProjectExtensions.vsix and follow instructions to install it.

    2. Import the PowerShell module (NanoServerDebugger.psm1) by opening an elevated PowerShell or ISE session, use Import-Module and pass the full path to the .psm1 file.  Don’t close the PowerShell session! If you do, you would have to import the module every time you open the PowerShell session (unless you use a PowerShell profile of course :)).

    Use the blog and downloadable PowerShell script to build your Nano Server VHD, and then use it to boot on a physical machine or in a VM.

Writing your First App

Now you’re ready to develop your first Nano Server app. Let’s write and debug a simple “Hello, Nano Server!” app.

  1. Create a new project and, under Visual C++, choose “NanoServerApplication”. 

  2. In the debug target drop down, select x64 as the target platform

  3. In the Project Properties dialog, under “General”, make sure that the “Target Platform Version” is 10.

  4. In Solution Explorer, double-click on NanoServerApplication.cpp. In _tmain, add printf(“Hello, Nano Server!\n”); Press Ctrl+F5 to make sure everything works locally.

  5. From an elevated PowerShell or ISE console (import the PowerShell module again if you closed the previous console), create a session to the Nano Server machine or VM, using the following commands (for more information, consult the Nano Server Getting Started guide):
    1. $ip = “ip address to the Nano Server machine

    2. Ensure that TrustedHosts is set to the Nano Server IP address. Otherwise: Set-Item wsman:\localhost\client\TrustedHosts “ip address to the Nano Server machine

    3. $s = New-PSSession –ComputerName $ip –Credential ~\Administrator

    4. Install-NanoServerDebugger –session $s

  6. Copy the .exe and the .pdb files from the app you just wrote to Nano Server, using the same session object:
    1. Enter-PSSession $s

    2. Md c:\NanoApp1   # for example

    3. Exit-PSSession

    4. Copy-Item –ToSession $s –path “path to the .exe and .pdb files” –Destination c:\NanoApp1. Remember to do this every time you build a new .exe! (Alternatively, you can refer to the local pdb file, but make sure to change the project properties to reflect that).

  7. In the project properties dialog, under Configuration Properties \ Debugging:
    1. Change the “Debugger to launch” to: “Remote Windows Debugger”. 

    2. Remote Command = C:\NanoApp1\NanoApp1.exe (full path to the Nano app executable)

    3. Working Directory = C:\NanoApp1 (path to the Nano app executable folder)

    4. Remote Server Name = IP address of the Nano Server machine

    5. Connection = “Remote with no authentication”

  8. In the open PowerShell console, start the debugger using Start-NanoServerDebugger –Session $s

  9. Now you’re ready to debug your app.  Set a breakpoint and press F5 and you’re good to go! Use locals, watches … pretty much everything you’re used to using in a debugging session.

  10. To stop the debugger, use: Stop-NanoServerDebugger –Session $s         


Now that “Hello, Nano Server!” is working, try your hand at a WMI provider, such as this MI API sample (which also creates a PowerShell cmdlet along with the provider), or Querying a Service's Configuration.

At any rate, you’ll want to make sure that your application can participate in a DevOps management model.  This entails two things:

  1. Ensure your application can be fully configured using PowerShell Desired State Configuration (DSC).  Writing a DSC provider ensures that customers can choose the DevOps deployment tool of their choice and ensure that your application will “just work”. (Note that DSC is not available on Nano Server yet, but this is the best practice, listed here for completeness)

  2. Ensure your application can be fully managed remotely via PowerShell.  You can write PowerShell cmdlets in native code using a WMI V2 provider, in managed code using .NET Core, or in PowerShell itself.

Please use the Nano Server forum to ask questions. We look forward to your feedback. 

Happy coding 🙂





Comments (13)
  1. Aditi Satam says:

    Created my first app on Nano Server! Thanks Refaat.

  2. ref@ says:

    @Aditi: Thanks for sharing! Please keep the feedback coming

  3. jamie says:

    Any idea when we’ll get the C# project templates promised?

  4. Dustin Metzgar says:

    In the project properties for setting the target platform all I see is Windows 8.1, not 10. I’m running VS2015 Enterprise RTM. Any ideas what’s wrong? I’m hoping to build a VC++ application compiled for OneCore.

  5. ref@ says:

    @Dustin, did you check the "Windows Tools" check box during installation?

  6. anonymouscommenter says:

    Over the coming weeks, we’ll be publishing more on Windows Server 2016 and the key capabilities

  7. anonymouscommenter says:

    Introduce Windows Server Apps (WSAs), based on APPX, to package and install an application on Nano Server.

  8. Everything worked perfectly. Quick question: Is there any way to get console output in the debugger? I can get the exit code and see state of code no problem while debugging, but I’d like to see the output as well. Is this possible?

    Additional note, you really should add a step to the blog to automatically copy the files post-build up to the nano server. It’s pretty simple to do, just add a post-build event. This is what mine looks like with my paths, servername, and credentials. You could
    also store the creds to disk in order to supress the cred popup on each build:

    C:WINDOWSSystem32WindowsPowerShellv1.0powershell.exe -noprofile -command copy -ToSession (new-pssession nano -credential (get-credential toenuffAdministrator)) ‘C:usersTomeDocumentsVisual Studio 2015Projectsnanoworldx64Debugnanoworld.*’ c:nano

  9. Igor Sychev says:

    We need an update for Visual Studio 2015 update 1. Because :

    PS C:tempMoexNanoSoftwareDebug> Install-NanoServerDebugger $s
    You have Visual Studio 2015 Update 1 or higher installed. The cmdlets you’re using are obsolete. Please refer to the Nano Server blog for details.

  10. @Igor: i’m working on it. Sorry for the inconvenience

  11. Rick Hicksted says:

    Running the Nano Server test EXE from VS 2015 U1 yields no output via the Nano PS session.

    Any special procedure.

    Note: I am just running the Hello Nano project outlined above.



  12. @Igor and @Rick: I just posted a new blog post which addresses Visual Studio 2015 Update 1 and above:
    Thank you for your patience

  13. Rocky says:

    I am not getting simple output of printf("Hellon"). exe file returns without printing anything. Any hint where I am going wrong?

Comments are closed.

Skip to main content