Cannot find Task-related types. Are you missing a reference to 'AsyncCtpLibrary.dll' ?_
-
2012年2月21日 下午 05:08
I have downloaded the CTP and uninstalled previous versions. I have VS2010 Sp1 Professional. The install seemed to go fine and I have the dll and samples. However, even the C# 101 sample gets the above error as well as any samples I have tried to create. I opened the dll and it has the TaskAwaiter<T> method and the reference points to the correct directory. I uninstalled everything, - checked for the KB* updates I saw referenced in the forums, installed the phone sdk (which I really don't need now) and re-installed. Same thing. Any help?
I checked and this is the only AsyncCtpLibrary.dll on my system. CSC version is 4.0.30319.517
所有回覆
-
2012年2月22日 上午 02:43
-
2012年2月22日 上午 03:17Desktop. That is the exact error. "Cannot find Task related types. Are you missing a reference to AsynCtpLibrary.dll?"
-
2012年2月22日 上午 04:09In the samples solution or any other solution you're trying to use the dll, open the references section and see if there's a yellow mark by the async library/dll. This often happens when the location of the dll is not found in same location of the solution. Just right click on it, delete the reference and add it back in using the proper location of the DLL.
JP Cowboy Coders Unite!
-
2012年2月22日 上午 04:21Thanks but it was in the proper location and adding it back did not help.
-
2012年2月22日 下午 04:46
Can you write a very simple application that reproduces this?
For example, this .NET Framework 4.0.2 Client Profile console application:
namespace ConsoleApplication3 { using System.Threading.Tasks; class Program { static void Main(string[] args) { Async().Wait(); } static async Task Async() { await TaskEx.Yield(); } } }Works with just a reference to AsyncCtpLibrary (version 1.0.4107.18181) (mscorlib is implicit).Paulo Morgado -
2012年2月22日 下午 05:57
Ok so if references are correct the last thing to do is add the using statement in the code:
using System.Threading.Tasks;
Paulo showed this in the example above.JP Cowboy Coders Unite!
-
2012年2月22日 下午 08:12
from your example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Async().Wait();
}static async Task Async()
{
await TaskEx.Yield();
}
}
}
I get the following:
Error 2 Missing compiler required member 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Create'
Error 1 Cannot find Task-related types. Are you missing a reference to 'AsyncCtpLibrary.dll' ?
Error 3 'System.Runtime.CompilerServices.YieldAwaitable' does not contain a definition for 'IsCompleted'I feel like I have inconsistent versions, so I uninstalled, checked that I had no other AsyncCtpLibrary.dll laying around, then reinstalled ..still the same.
Thanks for your help.
-
2012年2月22日 下午 08:23I do have Silverlight 5 installed (from a message on another forum)
-
2012年2月22日 下午 10:19
Silverlight 5? If it's a Silverlight 5 application then you'll need to reference AsyncCtpLibrary_Silverlight5, not AsyncCtpLibrary.Paulo Morgado- 已提議為解答 Stephen Toub - MSFTMicrosoft Employee, Moderator 2012年2月28日 下午 07:34
-
2012年2月28日 下午 08:33It is not a Silverlight App. I was trying to compile the samples. I have since uninstalled everything and now it won't re-install. I had a sample program written in the old ctp version and was just trying to get anything working in order to evaluate potential usage in a real project. I think I have now invested enough time in this and will just wait for a release version.



