Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
F# 无法对f中的多个文件使用继承#_F# - Fatal编程技术网

F# 无法对f中的多个文件使用继承#

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

我在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中,我得到以下错误:

  • 没有可用于“资源”类型的构造函数。
  • 未定义“资源”类型。
感觉好像有一个简单的解决方案,但到目前为止,我还是没有想到

一些背景:

  • 以下是我找到的示例和文档。[]
  • 使用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>