0

I would like to use project.json in a net4.0 library instead of package.config It s working perfectly well but for use of Microsoft.Bcl.Build which enable the use of async/await. Any idea how I can correct this.

Thanks

Bhugot
  • 666
  • 5
  • 2
  • What does not work when you tried? Also, it is `Microsoft.Bcl.Async` not `Microsoft.Bcl.Build` (which is a dependency of `Microsoft.Bcl.Async`) which you should be doing for async/await in .NET 4.0 – Scott Chamberlain Jul 13 '16 at 13:53
  • When I try this, I get the error: "System.Security.VerificationException: Method System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted: type argument 'Microsoft.Runtime.CompilerServices.TaskAwaiter' violates the constraint of type parameter 'TAwaiter'." Is that what you're talking about? – svick Jul 13 '16 at 13:56
  • Just create a Net 4.0 ClassLibrary project. Add project.json { "frameworks": { "net40": { "frameworkAssemblies": { "Windows": { "type": "build" } } } }, "runtimes": { "win": {} }, "dependencies": { "Microsoft.Net.Http": "2.2.29" } } Then Create a class like this public class Class1 { public async Task Test() { await Task.Factory.StartNew(() => { }); } } and try to compile – Bhugot Jul 13 '16 at 14:23
  • @Bhugot What exactly happens when you do that? What error are you getting? – svick Jul 13 '16 at 14:49
  • Task does not contain a definition for 'GetAwaiter' – Bhugot Jul 13 '16 at 15:34
  • someone got some hints on this? – Bhugot Jul 29 '16 at 11:43

0 Answers0