UWP(一)开发入门
异常问题总结
Your project file doesn't list 'win10' as a "RuntimeIdentifier". You should add 'win10' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore
尝试一:Add this:
<RuntimeIdentifier>win</RuntimeIdentifier>to your project file, for example after elementTargetFrameworkVersion. Make sure the element name is singular.RuntimeIdentifierson the other hand is used in the new csproj format尝试二:通过VS Installer重新安装UWP。
通过UWP调用Win32,在.Net Framework中报错:“必须添加对程序集"Windows.Foundation.FoundationContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime"”的引用。并且,无法找到此程序集,且Reshaper工具也无法添加。另外,微软Samples中可用的源代码,引用中的
Windows有黄色感叹号。尝试一:It seems there are some issue with your 16299 and 15063 SDK file, you can try to open the file explorer and go to the corresponding file location to see whether the SDK is existed.
The path should be:
C:\Program Files (x86)\Windows Kits\10\References\10.0.15063.0(10.0.16299.0)\Windows.Foundation.FoundationContract\3.0.0.0\Otherwise, you can try to download and install the SDK version again from the Windows SDK and emulator archive.
If this still can not work, please also try to update the Microsoft.NETCore.UniversalWindowsPlatform Nuget to the latest version then restart your VS, clean and rebuild your app again. By the way, please also provide your device OS version and OS build to help me look into this issue.
---Update---
Another workaround is that you can declare the contents of the ResourceDictionary after the
<ResourceDictionary.ThemeDictionaries></ResourceDictionary.ThemeDictionaries>tag pair. This will prevent the crash from triggering.尝试二:打开报错的
csproj文件,找到Windows引用项,如下:<Reference Include="Windows">
<HintPath>D:\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd</HintPath>
</Reference>
黄色感叹号,一般是找不到指定文件,右键属性看到路径(Path)为空也证明了这一点。因此,使用Everything搜索windows.winmd文件,找到合适版本的文件,替换成此文件的路径,保存
csproj文件即可。注意,这里发现,ApplicationData.Current.LocalSettings.Values不能引用Windows.Foundation.UniversalApiContract,这是错误的引用。通过UWP调用Win32,UWP工程找不到:
Windows.ApplicationModel.FullTrustProcessLauncher,且在添加引用-Universal Windows-扩展下面无法找到Windows Desktop Extensions for the UWP引用。解决:Missing Windows Desktop Extension SDK for UWP。For random reason your Windows SDK can be installed to wrong directory. For me it is
C:\Program Files (x86)\Microsoft Platform SDK. Right path isC:\Program Files (x86)\Windows Kits\10I just made symbol link。mklink /j “C:\Program Files (x86)\Windows Kits\10” “C:\Program Files (x86)\Microsoft Platform SDK”
注意,此方案或可解决2.的问题。
.Net Framework工程使用
Windows.ApplicationModel.AppService.AppServiceConnection.OpenAsync()报错:“IAsyncOperation<AppServiceConnectionStatus>”不包含“GetAwaiter”的定义,并且找不到可接受类型为“IAsyncOperation<AppServiceConnectionStatus>”的第一个参数的扩展方法“GetAwaiter”(是否缺少针对“System”的 using 指令?)。解决:查看微软Samples中可用的源代码,发现相比缺少了
System.Runtime.WindowsRuntime。打开项目文件,添加如下代码即可解决。<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SystemDrive)\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
调用
StorageFile.GetFileFromPathAsync(filePath)报错:System.UnauthorizedAccessException:“拒绝访问。 (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))”。解决:编辑Package.appxmanifest,在
<Capabilities>中添加<rescap:Capability Name="broadFileSystemAccess" />未完待续...
UWP(一)开发入门的更多相关文章
- UWP开发入门(十六)——常见的内存泄漏的原因
本篇借鉴了同事翔哥的劳动成果,在巨人的肩膀上把稿子又念了一遍. 内存泄漏的概念我这里就不说了,之前<UWP开发入门(十三)——用Diagnostic Tool检查内存泄漏>中提到过,即使有 ...
- UWP开发入门(十一)——Attached Property的简单应用
UWP中的Attached Property即附加属性,在实际开发中是很常见的,比如Grid.Row: <Grid Background="{ThemeResource Applica ...
- UWP开发入门系列笔记之(一):UWP初览
标签: 随着微软Build2015带来的好消息,Win10正式版发布的日子已经离我们越来越近了,我们也终于欣喜地看到:一个统一的Windows平台对于开发人员来说充满了吸引力,这局棋下的好大的说--于 ...
- UWP开发入门(十)——通过继承来扩展ListView
本篇之所以起这样一个名字,是因为重点并非如何自定义控件,不涉及创建CustomControl和UserControl使用的Template和XAML概念.而是通过继承的方法来扩展一个现有的类,在继承的 ...
- UWP开发入门(四)——自定义CommandBar
各位好,再次回到UWP开发入门系列,刚回归可能有些不适应,所以今天我们讲个简单的,自定义CommandBar,说通俗点就是自定义类似AppBarButton的东西,然后扔到CommandBar中使用. ...
- UWP开发入门(一)——SplitView
接下来会写一个UWP(Universal Windows Platform)开发入门的系列,自己学习到哪里,有什么心得总结,就会写到哪里.本篇对适用于顶层导航的SplitView控件展开讨论. 首先S ...
- UWP开发入门(25)——通过Radio控制Bluetooth, WiFi
回顾写了许久的UWP开发入门,竟然没有讲过通过Windows.Devices.Radios.Radio来控制Bluetooth和WiFi等功能的开关.也许是因为相关的API设计的简单好用,以至于被我给 ...
- UWP开发入门系列笔记之(零):UWP的前世今生
引言 在本篇文章中,可以掌握以下知识: 设备族群,如何决定目标设备 新的UI控件和新面板帮助你适应不同的设备特征 从Windows 8系统开始,微软就 引入了WindowsRT(Windows Run ...
- (二)Hololens Unity 开发入门 之 Hello HoloLens~
学习源于官方文档 微软官文~ 笔记一部分是直接翻译官方文档,部分各人理解不一致的和一些比较浅显的保留英文原文 (二)Hololens Unity 开发入门 之 Hello HoloLens~ 本文主要 ...
- openresty 前端开发入门五之Mysql篇
openresty 前端开发入门五之Mysql篇 这章主要演示怎么通过lua连接mysql,并根据用户输入的name从mysql获取数据,并返回给用户 操作mysql主要用到了lua-resty-my ...
随机推荐
- 【Linux】find查找空文件夹
linux下批量删除空文件(大小等于0的文件)的方法 find . -name "*" -type f -size 0c | xargs -n 1 rm -f 就是删除1k大小的文 ...
- PyTorch 于 JupyterLab 的环境准备
PyTorch 是目前主流的深度学习框架之一,而 JupyterLab 是基于 Web 的交互式笔记本环境.于 JupyterLab 我们可以边记笔记的同时.边执行 PyTorch 代码,便于自己学习 ...
- STGAN: A Unified Selective Transfer Network for Arbitrary Image Attribute Editing 阅读笔记和pytorch代码解读
一.论文采用的新方法 1.AttGan中skip connect的局限性 由于encoder中对特征的下采样实际上可能损失部分特征,我们在decoder中进行上采样和转置卷积也无法恢复所有特征,因此A ...
- [Usaco2016 Dec]Counting Haybales
原题链接https://www.lydsy.com/JudgeOnline/problem.php?id=4747 先将原数组排序,然后二分查找即可.时间复杂度\(O((N+Q)logN)\). #i ...
- 集成 12 种协议、可于 USBC 端口的快充协议芯片IP2188
1. 特性 支持 12 种 USB 端口快充协议 支持 USB TypeC PD2.0/PD3.0/PPS DFP 协议 支持多种充电协议(QC3.0/QC2.0,FCP,SCP, AFC,MT ...
- 2V转5V输出,2.4V转5V输出,DC-DC同步整流升压电路
PW5100可以适用于2V转5V和2.4V转5V的应用电路中,PW5100是一颗DC-DC的同步升压转换器芯片. PW5100特点: 1, 低输入,宽范围:0.7V-5V 2, 输出电压固定,外围少: ...
- 3、wait和waitpid
1. 函数介绍 wait函数:调用该函数使进程阻塞,直到任意一个子进程结束,或者该进程接收到了一个信号为止,如果该进程没有子进程或该进程的子进程已经结束,wait函数立即返回. waitpid函数:与 ...
- 【Azure Developer】在Azure Resource Graph Explorer中查看当前订阅下的所有资源信息列表并导出(如VM的名称,IP地址内网/公网,OS,区域等)
问题描述 通过Azure的Resource Graph Explorer(https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade),可以查 ...
- goroutine 分析 协程的调度和执行顺序 并发写 run in the same address space 内存地址 闭包 存在两种并发 确定性 非确定性的 Go 的协程和通道理所当然的支持确定性的并发方式(
package main import ( "fmt" "runtime" "sync" ) const N = 26 func main( ...
- C语言中使用类似awk的功能
awk实在是太强大了, 非常复杂的任务,几行代码就可以解决, awk经常需要用到, 但是在c语言里面, 调用system不太优雅, 能不能直接在c语言中直接调用呢,简单实现了一些功能, 但大多数情况, ...