How to write to a file in .NET Core?
<p>I want to use the Bluetooth LE functions in .NET Core (specifically, BluetoothLEAdvertisementWatcher) to write a scanner which logs information to a file. This is to run as a desktop application and preferably as a command line app.</p>

<p>Constructors like System.IO.StreamWriter(string) are not available, apparently. How do I create a file and write to it?</p>

<p>I would be just as happy to be able to do a System.Console.WriteLine(string) but that doesn't seem to be available under .NET Core either.</p>

<p>Update: To clarify, if I could have a program that looks like this run without error, I'll be off to the races.</p>

<pre><code>using System;
using Windows.Devices.Bluetooth.Advertisement;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            BluetoothLEAdvertisementWatcher watcher = new BluetoothLEAdvertisementWatcher();
            Console.WriteLine("Hello, world!");
        }
    }
}
</code></pre>

<p>Update 2: Here's the project.json file:</p>

<pre><code>{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}
</code></pre>

<p>The output of the command <code>dotnet -v run</code> contains this error message:</p>

<pre><code>W:\src\dotnet_helloworld&gt;dotnet -v run
...
W:\src\dotnet_helloworld\Program.cs(2,15): error CS0234: The type or namespace name 'Devices' does not exist in the namespace 'Windows' (are you missing an assembly reference?)
...
</code></pre>