我在f#项目中遇到一些似乎是微不足道的继承问题。
文件1:
namespace MercurySchool.Models
[<AbstractClass>]
type Resource() =
abstract member Href: string with get, set
abstract member Method: string with get, set
abstract member Relations: string[] with get, set
abstract member Id: int with get, set
abstract member Name: string with get, set
abstract member Description: string with get, set
文件2:
namespace MercurySchool.Models
type School() =
inherit Resource()
在文件2中,我收到以下错误:
No constructors are available for the type 'Resource'
The type 'Resource' is not defined.
感觉就像有一个简单的解决方案,但到目前为止它逃脱了我。
一些背景知识:
答案 0 :(得分:1)
问题确实似乎是汇编的顺序,正如Fydor所说。
我更改了fsdprog
文件:
<ItemGroup>
<Compile Include="Models\*.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
更明确的声明:
<ItemGroup>
<Compile Include="Models\Resource.fs" />
<Compile Include="Models\school.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
在与此问题无关的其他一些更改后,项目构建。