Creating and using resources within Windows Core IOT

337 views Asked by At

I am building a Windows Core IOT background task application on a Raspberry Pi, and I need to store some text resource files (html,css,js) to serve over a tcp socket connection.

Trouble is I am struggling to find the simplest way to have a folder of these files as embedded resources which I can access from the webserver I have built.

Any suggestions would be good.

I do not seem to have access to the Properties namespace.

1

There are 1 answers

0
Ikarus76 On BEST ANSWER

include the files into your project and access them with the InstalledLocation Folder.

If, for example, you have a folder named 'html' in your project structure, access the files like this:

async void ExampleFunc()
{
    // get the StorageFolder
    var WebRoot = await Package.Current.InstalledLocation.GetFolderAsync("html");
    // load the file (StorageFile)
    var file = await WebRoot.GetFileAsync("index.html");
}