Jeffrey Hantin
Jeffrey Hantin

Reputation: 36494

Any way to use async/await on Compact Framework 3.5?

I'm curious as to whether there will be any way to use the C# async/await CPS transformation feature with Compact Framework code. I expect a certain amount of library code will need to be supplied/reimplemented in order to make that happen; if so, where should I look for information on what types/members would need to be provided?

(I'm not looking for a complete task-asynchrony support library here, just enough of a skeleton to be able to use the language feature.)

Upvotes: 1

Views: 2435

Answers (2)

Skarllot
Skarllot

Reputation: 754

You can use Visual Studio 2015 to compile to Compact Framework 3.5 by following the instructions below:

  • Install the '.NET Compact Framework 3.5 Redistributable';
  • Copy files from 'C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE';
  • Paste the files at 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\CompactFramework' directory;
  • Create a directory named 'RedistList';
  • Create a file named 'FrameworkList.xml' at 'RedistList' directory;
  • Set the follwing content to the file created:

    <?xml version="1.0" encoding="utf-8"?>
    <FileList Redist="Net35-CF" Name=".NET Compact Framework 3.5">
    </FileList>
    

Now you can create a .NET Core Class Library project on Visual Studio 2015 and target 'net35-cf' framework.

To use async/await you can use the System.Threading.Tasks.WindowsCE package.

An example project can be found at: https://github.com/WindowsCE/System.Collections.Concurrent/tree/08669ca5b45cc5c74c8c225a633828f9e26b5276

Disclaimer: I'm the author of the package and the project above.

Upvotes: 1

Stephen Cleary
Stephen Cleary

Reputation: 456537

You can try Jon Skeet's eduasync series for the library side, but I'm not sure whether the Async CTP compiler update will work for CF development. Last I checked, CF wasn't supported on VS2010, but Async CTP requires VS2010 SP1.

P.S. CF is on the way out, I'm afraid. It's all semi-Silverlight for "device" programming in the future.

Upvotes: 1

Related Questions