Heisenbug
Heisenbug

Reputation: 39164

how using a F# library inside C# (and XNA) classes with visual studio 2010

I have developed a little game using XNA 4.0 and C# (new Project->Windows Game 4.0 ). Now I have to refactor all the game logic and write it in F#.

I created a new project for my F# library(new Project->F# Library), and added the XNA library to the project's references.

Now, how can I include the F# library inside my C# project?

Upvotes: 0

Views: 318

Answers (3)

Tomas Petricek
Tomas Petricek

Reputation: 243041

I don't have my own experience with writing XNA libraries in F#, but I suppose that you may need to change some project properties to be able to reference the F# library from C# XNA application. I don't know exactly which project settings need to be changed, but there are two online templates that you can download and use as a starting point:

Aside, you can also find them if you click on "Online Templates" in the "New Project" dialog in Visual Studio and search for "F# XNA". There is quite a few, very useful, templates contributed by the F# community!

Upvotes: 1

George Duckett
George Duckett

Reputation: 32428

I assume the problem is referencing your F# library project from your C# one, rather than using the XNA library from in your F# project.


In the same way you'd reference a C# project:

Add the F# project to your solution and add a reference to the F# project in your other one

Upvotes: 3

Duke Hall
Duke Hall

Reputation: 582

Compile the F# library and include it into your solution. I had to do this a while back to get the Financial Functions library: http://blogs.msdn.com/b/lucabol/archive/2008/12/04/financial-functions-for-net-released.aspx

Upvotes: 1

Related Questions