F# 无法对f中的多个文件使用继承#
我在f#项目中对继承的一个微不足道的使用上遇到了麻烦 文件1:F# 无法对f中的多个文件使用继承#,f#,F#,我在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[] w
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中,我得到以下错误:
没有可用于“资源”类型的构造函数。
未定义“资源”类型。
- 以下是我找到的示例和文档。[]
- 使用VS2017社区。最近更新
- 正如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>
在进行了一些与此问题无关的其他更改后,项目将生成。文件2是否按照编译顺序列在文件1之后?我看到了一些关于文件顺序的信息。这在fsproj文件中定义了吗?是的,它在项目文件中定义了
<ItemGroup>
<Compile Include="Models\Resource.fs" />
<Compile Include="Models\school.fs" />
<Compile Include="Program.fs" />
</ItemGroup>