JetBrains / resharper-fsharp

F# support in JetBrains Rider
Apache License 2.0
326 stars 55 forks source link

Referenced projects not working, "The namespace or module is not defined" errors #61

Open deyanp opened 5 years ago

deyanp commented 5 years ago

Started evaluating Rider for F# a couple of minutes ago, opened an existing F# sln consisting of 5 projects, most of them referencing a project in another solution using the standard

<ProjectReference Include="..\..\..\AnotherProject\src\AnotherProject\AnotherProject.fsproj" >
  <Name>Framework.fsproj</Name>
</ProjectReference>

However in all files the types and functions from AnotherProject are marked red, with the error "The namespace or module is not defined".

Tried unloading/reloading the sln and projects, did not help. Build works fine.

auduchinok commented 5 years ago

@deyanp Thank you for the report. Unfortunately, I'm not able to reproduce this behavior. Is there any chance you could share the solution it reproduces on? We can sign an NDA if needed.

deyanp commented 5 years ago

Would a short "Screen Sharing" session tomorrow (Monday) at some time during the day (CET) be possible instead of sending you all the whole source code? Or do you need only the *.fsproj files?

I am trying to find out what is so different about the Framework.fsproj, as references to other projects seem to work ...

I see this and don't know why it so (vscode + ionide works OK, also build is OK): image

deyanp commented 5 years ago

When I delete and try to re-add the reference to Framework.fsproj from the UI I get:

image

deyanp commented 5 years ago

my skype is: deyanp (https://join.skype.com/invite/MIJSgbdVrzMx)

deyanp commented 5 years ago

Could it be that only projects up 1 folder (..) can be referenced?

deyanp commented 5 years ago

Not sure if it is related, but if I change something in the referenced project (Framework.fsproj) then building/rebuilding the project depending on it (Shared.fsproj or any other) does not consider that change ...

deyanp commented 5 years ago

@auduchinok can you help? I am eagerly looking for moving from vs code + ionide to rider for F# development ...

deyanp commented 5 years ago

Found the reason for the red project references: <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />

auduchinok commented 5 years ago

@deyanp Could you please check if adding the referenced project to solution helps in any way? What is changed if you change/remove the Functions package reference?

auduchinok commented 5 years ago

If you could make and share a small solution where it reproduces it would really help. If not, at least sharing your fsproj is a good way to go further.

deyanp commented 5 years ago

well, check DepProj1 in this repo: https://github.com/deyanp/RiderProjectIssue ...

lsim commented 4 years ago

Was this resolved? I'm trying to learn F# using rider and I am stuck on a super basic app with two modules in separate files, one referencing the other. They are in the same namespace - and the code comes from an example repo, so should be valid.

The problem I see is that my Program.fs cannot reference the Counter module exposed in the second file. The code is from here

counter-problem

In all likelihood I am making some really basic mistake. All the same I would appreciate any hints that would help me proceed with using rider for f# development.

<edit> After cloning the example repo again I got the code compiling and running. I can probably dig out my blunder by comparing. Sorry about crashing the thread. </edit>

heronbpv commented 4 years ago

@lsim I believe in your case it's just the order of files in .fsproject. File ordering is important in fsharp, so you can't reference a module defined in a file below the current one.

lsim commented 4 years ago

Dude, thank you! It would have taken me a long time to arrive at that explanation.

I was not expecting to maintain the .fsproj by hand :)

auduchinok commented 4 years ago

I was not expecting to maintain the .fsproj by hand :)

@lsim You can also drag-and-drop files right in the Solution/Project tree. :)