在 Windows Core IOT 中创建和使用资源

Creating and using resources within Windows Core IOT

我正在 Raspberry Pi 上构建一个 Windows Core IOT 后台任务应用程序,我需要存储一些文本资源文件 (html,css,js ) 通过 tcp 套接字连接提供服务。

问题是我正在努力寻找将这些文件的文件夹作为嵌入式资源的最简单方法,我可以从我构建的网络服务器访问这些文件。

有什么建议就好了。

我似乎无法访问 Properties 命名空间。

将文件包含到您的项目中并使用 InstalledLocation 文件夹访问它们。

例如,如果您的项目结构中有一个名为 'html' 的文件夹,请按如下方式访问文件:

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");
}