I am still trying to get my head around namespaces in referenced projects.
I have ac# project where a namespace ("A") is defined. I create a F# application, where I reference the c# project.
open A
leads to the following:
error FS0039: The namespace or module 'A' is not defined
This is what I have checked:
MSDN is not much of a help ( http://msdn.microsoft.com/en-us/library/vstudio/dd393787.aspx ).
Thanks.
[EDIT]
I have started from scratch, so that the example is lean and clean.
The C# project "ClassLibrary1" contains:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassLibrary1
{
public class Class1
{
}
}
The F# Application is:
// Learn more about F# at http://fsharp.net
// See the 'F# Tutorial' project for more help.
open ClassLibrary1
[<EntryPoint>]
let main argv =
printfn "%A" argv
0 // return an integer exit code
The error:
The namespace or module 'ClassLibrary1' is not defined
Make sure your reference is a real project references and not just referencing the DLL in the bin\\Debug folder.
If you can't get a real project reference to work, make sure the F# project is set to depend on the C# project so that it gets built first by Visual Studio (right-click on the project and go to Project Dependencies then use the tickboxes).
I had this same issue. All I had to do was make sure my C# project dependencies were all settled, build my C# projects, then the F# project was able to reference the correct dll's.
In Visual Studio, you can right click on each C# project and press build. In VSCode, you have to use the terminal to navigate to each project and run dotnet build
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.