如何解决&QUOT; “IAsyncActionWithProgress&LT;&GT;'在不引用&QUOT一个组件被限定;在Windows应用UAP [英] How to resolve " 'IAsyncActionWithProgress<>' is defined in an assembly that is not referenced" in Windows UAP app
问题描述
我正在开发在Visual Studio旗舰版CTP 2015年一个Windows应用程序UAP(最近一次在网站上提供)。
I am developing a Windows UAP app in Visual Studio Ultimate CTP 2015 (latest one available in site).
我在使用等待关于函数返回的问题,面临的 IAsyncActionWithProgress&LT;>,IAsyncAction&LT;>,IAsyncOperation&LT;>和IAsyncOperationWithProgress&LT;>
I am facing issues while using await on Functions returning IAsyncActionWithProgress<>, IAsyncAction<> , IAsyncOperation<> and IAsyncOperationWithProgress<>.
我收到以下错误
错误
CS0012
类型'IAsyncActionWithProgress&LT;>'在未引用的程序集定义。您必须添加一个引用程序集的Windows,版本= 255.255.255.255,文化=中性公钥= NULL,则contentType = WindowsRuntime'。
我尝试添加引用提到的组件(Windows)中。尽管这解决了上面的错误,它在其他许多地方创造了另一个错误(好像有两个程序集的一些类/ API的一个重复中获得的错误是:
I tried adding reference to the assembly mentioned (Windows). Even though this resolved the above error, it created another error at many other places (seems like there is a repetition of some classes/API's in both the assemblies. One of the error obtained is :
错误
CS0433
类型页存在于两个'Windows.Foundation.UniversalApiContract,版本= 1.0.0.0,文化=中性公钥= NULL,则contentType = WindowsRuntime和Windows,版本= 255.255.255.255,文化=中立,公钥=空,则contentType = WindowsRuntime'。
code示例
Windows.Storage.FileProperties.BasicProperties fileSize = await file.GetBasicPropertiesAsync();
在Visual Studio 2013的Windows Phone 8.1的应用程序这是工作的罚款。
什么是我必须做出得到同样的结果在UAP应用程序在Visual Studio 2015年的变化。
This was working fine for a Windows Phone 8.1 app in Visual Studio 2013. What is the change I have to make to get the same result in UAP App in Visual Studio 2015.
推荐答案
我曾与IAsyncAction同样的问题,我刚才已经设法解决它,所以我要分享的(也许不是最好的)解决方案。
I had the same problem with the IAsyncAction and I have just managed to solve it, so I am going to share the (maybe not the best) solution.
首先,我试图修复VS,没有成功。然后再重新安装VS,又没有成功。于是我去控制面板 - >程序 - >卸载程序,并从那里我卸载时候有一些东西需要与Visual Studio或.NET的一切。这显示了我一对夫妇的错误,这样的一些应用程序需要此程序运行,但我无论如何卸载它(如果我需要它,我会重新安装)。之后,我又安装了Visual Studio,写了code造成错误,并且它的工作,没有错误。
First I tried repair VS, no success. Then reinstalling VS, again no success. So I went to control panel -> programs -> uninstall programs, and from there I uninstalled everything that had something to do with Visual Studio or .NET. It displayed me a couple of errors, like that some applications require this program to run, but i anyway uninstalled it (if I will need it I will install it again). After that I installed Visual Studio again, wrote the code which caused the error and, it worked, with no error.
希望这可以帮助你,因为它确实帮助我。
Hope this helps you as it did help me.
这篇关于如何解决&QUOT; “IAsyncActionWithProgress&LT;&GT;'在不引用&QUOT一个组件被限定;在Windows应用UAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!