" is defined in an assembly that is not referenced "in a Windows UAP application I am developing a UAP ap...">

How to enable "IAsyncActionWithProgress <>" is defined in an assembly that is not referenced "in a Windows UAP application

I am developing a UAP application for Windows in Visual Studio Ultimate CTP 2015 (the latter is available on the site).

I am having problems using the wait function that returns IAsyncActionWithProgress <>, IAsyncAction <>, IAsyncOperation <>, and IAsyncOperationWithProgress <>.

I get the following error

Error CS0012 The type 'IAsyncActionWithProgress <>' is defined in an assembly that is not referenced. You must add a reference to the assembly 'Windows, Version = 255.255.255.255, Culture = neutral, PublicKeyToken = null, ContentType = WindowsRuntime'.

I tried to add a link to the assembly mentioned (Windows). Although this error was fixed above, it created another error in many other places (it seems that some classes / APIs are repeating in both assemblies. One of the received errors:

Error CS0433 The type "Page" exists as in "Windows.Foundation.UniversalApiContract, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null, ContentType = WindowsRuntime" and "Windows", Version = 255.255.255.255, Culture = neutral, PublicKeyToken = null, ContentType = WindowsRuntime '.

Code example

 Windows.Storage.FileProperties.BasicProperties fileSize = await file.GetBasicPropertiesAsync(); 

This works fine for the Windows Phone 8.1 application in Visual Studio 2013. What change should I make to get the same result in the UAP application in Visual Studio 2015.

+6
source share
3 answers

I had the same problem with IAsyncAction, and I only managed to solve it, so I'm going to share (maybe not the best) solution.

At first I tried VS repair, without success. Then reinstalling VS again failed. Therefore, I went to the control panel -> programs -> uninstall programs, and from there I deleted everything related to Visual Studio or .NET. He showed me a couple of errors, for example, some applications require this program to run, but I deleted it anyway (if necessary, I will install it again). After that, I installed Visual Studio again, wrote the code that caused the error, and worked without errors.

Hope this helps you as it really helped me.

+3
source

It seems to me that the transition from Windows 8.1 to Windows 10 did not go completely right. Andy Wigley has a video with instructions on how to port a Windows 8.1 project to Windows 10. His example is for the phone, but it also applies to the desktop. Here's the video: http://www.microsoftvirtualacademy.com/training-courses/a-developers-guide-to-windows-10-preview . Go to the section entitled "Migrating 8.1 applications to Windows 10".

To be clear, you don’t need to add links to those that work in the universal Windows 10 application. A good starting point (according to Andy also points to his video) is to create a new black Windows 10 Universal App project and compare the project manifest files with it and package and just make changes.

+1
source

I think the problem is this: you can deploy to Windows Phone, but when you try to access certain phone features, you need to add enter image description here

0
source

Source: https://habr.com/ru/post/985256/


All Articles