Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild doesn't find async required references

We have Visual Studio 2010 SP1 and Async CTP (SP1 refresh) installed.

A solution with projects that use async/await keywords builds OK when build from VS IDE. Also when built with devenv /build "Debug" solution.sln everything is OK.

However msbuild @commands.rsp solution.sln reports:

File.xaml.cs(123): error CS1993: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?

commands.rsp looks like this:

/nologo
/p:Configuration=Debug
/m:3
/fileLogger

Any clues?

like image 589
Pasi Savolainen Avatar asked Mar 07 '12 11:03

Pasi Savolainen


1 Answers

Please, refer to the discussion here: http://social.msdn.microsoft.com/Forums/uk-UA/async/thread/3d491cb0-a19f-4faf-80a6-5fd05e4e06db

There are 2 points to be clarified in order to understand better your problem:

  • Environment: did you install VS11 side-by-side with VS 2010+Async CTP?
  • Your project: do you have XAML with user controls and "clr-namespace" in your project?

I will cite the preliminary conclusion by SERware from the discussion on the MS forum:

I think it has to do with the order in which the XAML projects compile assemblies when referring to classes of the library itself. In this case, the XAML Loader try to compile this classes before having reference to the Async CTP library. So, the keyword "async" is not recognized.

Personally I am going to see whether it is possible to split the assembly in order to resolve the order of the compilation of the dependencies in XAML

Added after further investigation: As I have found out, the explanation is even more disappointing: the .NET 4.5 (Beta) replaces the .NET 4.0. Besides, the signatures of the async/wait related types have been internally changed. Therefore there is no way so far to use simultaneously VS 2010+AsyncATP and VS11 Beta. – Yuri S. 2 mins ago

like image 103
Yuri S. Avatar answered Nov 12 '22 17:11

Yuri S.