I'm trying to use Microsoft.Bcl.Async
and Code Analysis, but when I run Code Analysis I get one or more errors.
I'm using Visual Studio 2012 with Update 2.
This is easy for me to reproduce:
- Create a new default Console App that targets
.Net 4
. - Right click
References
then selectManage NuGet Packages...
- Click
Online
and typeasync
into theSearch Online
box. - You should see
Async for .Net Framework 4 ...
. ClickInstall
and accept all questions. - Add to
Main()
a line that says:TaskEx.Delay(1000);
and ausing System.Threading.Tasks;
- Go to project properties, Code Analysis section and tick
Enable Code Analysis on Build
. - Compile the program.
I get two Code Analysis errors:
CA0052 Error Running Code Analysis CA0052 : No targets were selected. [Errors and Warnings] (Global)
CA0055 Error Running Code Analysis CA0055 : Could not load ConsoleApplication2.exe. The following error was encountered while reading module 'ConsoleApplication2': Could not resolve member reference: [Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]System.Threading.Tasks.TaskEx::Delay. [Errors and Warnings] (Global)
I get different code analysis errors for other test programs. A basic Windows Forms app I tried gives me:
CA0001 Error Running Code Analysis CA0001 : The following error was encountered while reading module 'AsyncForNet4': Could not resolve member reference: [Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]System.Threading.Tasks.TaskEx::Delay. [Errors and Warnings] (Global)
Two questions:
- Can anyone else reproduce this problem?
- Does anyone have a solution for it?