Build/Test Issues

NCrunch does not include files that have a custom build action

Started by abelb on 4,384 views

I have an FSharp project that doesn't build because it does not include referenced files from the project file. While I have found a workaround (include these files manually in the NCrunch settings), this is not a long-term solution, because that requires us to remember to add dependencies not only in the project, but also in NCrunch.

In particular, as in the screenshot (sorry, no screenshot, seems that this website does not allow uploading screenshots), this was my setting. First I had trouble getting the custom build action to run, I solved this per the instructions on http://www.ncrunch.net/documentation/considerations-and-constraints_implicit-file-dependencies. But now I still receive a file not found error for this file. It is included in the project file, so my assumption is, NCrunch ignores this dependency, even though it uses the standard syntax in the fsproj file.

Any workarounds to this?

Settings:
Build Action: FsLex
Copy to Output directory: Do Not Copy
File Name: AstLexer.fsl

In code:
  <ItemGroup>
    <Compile Include="PredefinedAst.fs" />
    <Compile Include="CompiledFiles\AstParser.fs">
      <Visible>false</Visible>
      <Link>AstParser.fs</Link>
    </Compile>
    <Compile Include="CompiledFiles\AstLexer.fs">
      <Visible>false</Visible>
      <Link>AstLexer.fs</Link>
    </Compile>
    <FsYacc Include="AstParser.fsy">
      <OtherFlags>--module Exselt.XPath.Parser.AstParser</OtherFlags>
    </FsYacc>
    <FsLex Include="AstLexer.fsl">
      <OtherFlags>--unicode</OtherFlags>
    </FsLex>
    <Compile Include="Common.fs" />
    <Compile Include="Parser.fs" />
  </ItemGroup>
Hi, thanks for posting.

NCrunch can only track files included in the project file that are of well known types. NCrunch isn't familiar with the 'FsYacc' and 'FsLex' tags, so it won't identify these files automatically. Adding them to the 'Additional files to include' setting for the project will allow you to work around this problem. I've made a note to add these to the auto discovery list in the next version of NCrunch.

Post a reply

Log in to reply.