I’m interested in using F#. I guess at some point in the future, Xenko will support F# right out of the box.
To get F# to work. I tried two things so far.
- I replaced the [project name].Game csproj file with a fsproj file.
- I created a new F# project added to the solution.
The first approach gave me Asset Compiler errors. Seems Asset Compiler is still looking for a .csproj file:
The command ““C:\Program Files\Silicon Studio\Xenko\GamePackages\Xenko.1.9.2-beta\Bin\Windows-Direct3D11\SiliconStudio.Assets.CompilerClient.exe” --disable-auto-compile --project-configuration “Debug” --platform=Windows --profile=Windows --project-configuration=Debug --output-path=“D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Bin\Windows\Debug\data” --build-path=“D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Windows…\obj\data” --package-file=“D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Windows…\Xenko FSharp.xkpkg” --log-pipe=”"" exited with code 1.
[AssetCompiler] Unexpected error while loading project [D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Game\ Xenko FSharp.Game.csproj] or assembly reference []. Exception: The project file could not be loaded. Could not find file ‘D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Game\Xenko FSharp.Game.csproj’. D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Game\Xenko FSharp.Game.csproj
[AssetCompiler] Error while loading package [SiliconStudio.Assets.Package]. Exception: The project file could not be loaded. Could not find file ‘D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Game\Xenko FSharp.Game.csproj’. D:\Americanum Mentis\Tech Projects\Xenko FSharp\Xenko FSharp\Xenko FSharp.Game\Xenko FSharp.Game.csproj
The problem with the second approach is, that I can’t use any F# code from the C# project. Because the C# game project is a portable class library. And they can’t reference normal class libraries such as the F# project I added. There are portable class libraries in Visual Studio for F#. They are tagged with Xamarin, Silverlight and UWP, but they can’t be referenced either. I can see C# libraries tagged with .Net Core and Portable. But there is no such thing for F# for some reason.
Beside of the problem to build successfully. I also suspect that Game Studio won’t show any F# components in its editor? Unity got a simple way of supporting F#/Native code. In Unity I only have to add an assembly that was built with F# code and that’s all. Unity would show the components in the editor so I can attach them to an entity. To solve this problem, I could use C# wrappers around F#.