I was having a look at CSLA (Trunk 22.214.171.124) and VS2012 refuses to compile both Csla.Net4 and Csla.Silverlight (SL5) projects on the grounds:
'System.Threading.Tasks.Task' does not contain a definition for 'Run'
It's the only error I got on both projects.
Microsoft.CompilerServices.AsyncTargetingPack 1.0.0 is installed. Microsoft.CompilerServices.AsyncTargetingPack.Net4 and Microsoft.CompilerServices.AsyncTargetingPack.Silverlight5 references are all right.
It's a Windows 7 Pro system, fully updated.
After some investigation, I added a NET45 symbol to the Csla project and changed the offending line as follows:
return Task.Run(() => dp.DoFetchAsync(objectType, criteria, true)).Result;
return TaskEx.Run(() => dp.DoFetchAsync(objectType, criteria, true)).Result;
Everything builds. Don't know if it runs :)
Seems like you have the AsyncCTP installed (TaskEx) and not the latest AsyncTargetingPack.
I run on Windows 7 Pro with VS2012 Premium and AsyncTargetingPack.
Use NuGet to install the targeting pack into these projects.
Been there done that. Today I repeated the steps Uninstall-Package / Install-Package several times . Even cleared the proxy cache.
As a side note, since both the reference and the DLL were already there, the Install-Package operation made no changes. I must conclude this wasn't needed at all. Every now and again some guys at Microsoft come up with some brilliant ideas. This is a simple DLL and it should be possible to add a reference as we do for every other DLL. Forcing us to use the package manager to add a reference to a project is really brilliantly convoluted. I guess they won the 2012 Olympics gold medal for the most convoluted idea.
Back to the trunk sources, if you take a look at
that is in
you will notice that around line 1778 TaskEx shows up. The respective DLL seems to know TaskEx also.
So... I feel confused. Any ideas?
Mmmm, must something that is added lately in the code that breaks the SL5 and .NET 4 projects.
So, yes - you are correct. We need to add compiler directives if this is the way to go.
I believe Rocky has been trying to find a way to make the sync portal use the async methods internally..
Just not sure if it is all working as it should yet.
I just wish to add that, since CSLA sources include the DLL and XML files, there is no need to install anything at all. Just tested with a fresh project.
Copyright (c) Marimer LLC