Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use namespace from project after including reference? F# C#

Tags:

c#

f#

I'm following a guide from Tomas Petricek on pluralsight. I'm trying to make a C# unit test project to test some methods from an F# library, however even after adding the reference to the F# project in the C# project I can't use any of the methods as they are not recognized and when trying to use the namespace from the F# project it is an unknown namespace.

Most solutions to questions like these appear to be the targeting of different frameworks, however, I am targeting 4.5.2 in both projects.

What could be going wrong?

like image 807
Zachscs Avatar asked Aug 09 '17 07:08

Zachscs


1 Answers

One thing to check is to make sure that the F# project is compiled and there were no errors.

When a C# project references an F# library, the C# compiler will look at the resulting dll file and provide auto-complete based on the compiled library. This is different than when you reference C# library from a C# project, because in this case, the auto-completion is based on the checks that Visual Studio does in background.

This means that, whenever you change the public API of the F# library, you need to recompile it to make sure that the C# project sees the latest version.

like image 58
Tomas Petricek Avatar answered Oct 06 '22 01:10

Tomas Petricek