Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use F# with the new Windows Universal apps?

Now that we can write F# apps for iPhone and Android thanks to the folks at Xamarin, I'm really surprised that it's such a pain to get F# going with Windows Phone. I just tried to add an F# project to an WinPhone 8.1 (RT based) project and get a rather unhelpful "Unable to add a reference to project ..." from Visual Studio 2013. I've added a reference to FSharp.Core from the portable libs folder (Version 2.3.5.1). I believe it can still be done with 8.1 Silverlight apps, but that kind of hoops the whole universal app idea.

Does anyone know if it's possible with some csproj hacks or anything? I'm very naïve when it comes to portable libs and how they work.

The brand new Win 10 apps don't support F# seemingly because of the .NET Native initiative. You can vote for F# support here https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/9110134-f-support-in-net-native-for-uwp

[Update]

I believe it may now be possible with the Centennial bridge https://developer.microsoft.com/en-us/windows/bridges/desktop

like image 933
Dylan Avatar asked Apr 29 '14 05:04

Dylan


People also ask

Should I use F strings?

As of Python 3.6, f-strings are a great new way to format strings. Not only are they more readable, more concise, and less prone to error than other ways of formatting, but they are also faster!

What is the use of \F?

The most common one is newline \n , but there are others. Many of them became less and less useful over time, such as \f . This is called form feed, is used to indicate to a printer that it should start a new page.

How do you backslash an F-string?

Use the Python backslash ( \ ) to escape other special characters in a string. F-strings cannot contains the backslash a part of expression inside the curly braces {} . Raw strings treat the backslash (\) as a literal character.

What is an F-string?

To define an f-string, you simply place an f before your string's first quotation mark, and insert variables wherever you want in the string using {} . Let's take a look at an example. Below, we define the same string as above, but this time using an f-string: >>> fruit = 'persimmon'


Video Answer


2 Answers

This seems to be classified as a bug at this moment: https://connect.microsoft.com/VisualStudio/feedback/details/845740/unable-to-add-reference-to-f-pcl-project-from-windows-phone-8-1-universal-project

The current workaround, as mentioned in the above link, is to add a reference to the resulting assembly/dll from your F# project directly (ie use "Browse" and point it to your "F#-based" dll), instead of adding a reference to your F# project. (At least this seems to work when using it in combination with FSharp.Core 3.3.1.0)

like image 186
Jarle Stabell Avatar answered Nov 14 '22 09:11

Jarle Stabell


Does anyone know if it's possible with some csproj hacks or anything?

As far as I know, not possible. This has been a disaster for Microsoft, BTW. A major client of ours wanted tens of thousands of tablets and they took Microsoft tablets off the table because they don't support F#.

like image 32
J D Avatar answered Nov 14 '22 10:11

J D