ApplicationData 在带有 UWP 参数的控制台中使用 [英] ApplicationData using in Console with UWP parameters

查看:16
本文介绍了ApplicationData 在带有 UWP 参数的控制台中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试关注 UWP桌面扩展 - UWP 和 WinForms 桌面桥调用进程和传递参数的第 2 部分.此示例控制台 Program.cs 代码包括参数字符串:

I'm trying to follow UWP with Desktop Extension – Part 2 of UWP and WinForms desktop-bridge calling the processes and passing parameters. This example Console Program.cs code includes parameters string:

 string parameters = ApplicationData.Current.LocalSettings.Values["parameters"] as string;

但是名称 ApplicationData 在当前上下文中不存在,我试图找出,如果我错过了一些参考或者它是不同版本的 C#

But the name ApplicationData does not exists in the current context, I'm trying to find out, if I've missed some reference or it is different version of C#

我不确定它是否需要,但是添加引用 Windows.Foundation.UniversalApiContract.windmd 会引发另一个带有 Values 的错误:

I'm not sure even if it is what it requires, but adding of reference Windows.Foundation.UniversalApiContract.windmd throws another error with Values:

错误 CS0012 类型IPropertySet"是在程序集中定义的没有参考.您必须添加对程序集的引用'Windows.Foundation.FoundationContract

Error CS0012 The type 'IPropertySet' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows.Foundation.FoundationContract

推荐答案

如果要使用 ApplicationData 类,请在 处添加 Windows.winmdC:Program Files (x86)Windows Kits10UnionMetadata10.0.17134.0Windows.winmd.然后添加 Windows.Storage 命名空间.

If you want to use ApplicationData class, please add Windows.winmd where in the C:Program Files (x86)Windows Kits10UnionMetadata10.0.17134.0Windows.winmd. Then add Windows.Storage namespace.

详细步骤

右键单击项目引用-> 添加引用-> 浏览(文件类型为所有文件)-> 选择Windows.winmd

Right click project References -> Add References -> Browse(file type all file)-> select Windows.winmd

这篇关于ApplicationData 在带有 UWP 参数的控制台中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆