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

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

问题描述

我正在尝试 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 会引发另一个错误,其中

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.winmd C中的位置: \程序文件(x86)\Windows套件\10\UnionMetadata\10.0.17134.0\Windows.winmd 。然后添加 Windows.Storage 命名空间。

If you want to use ApplicationData class, please add Windows.winmd where in the C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0\Windows.winmd. Then add Windows.Storage namespace.

详细步骤

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

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

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

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