Build/Test Issues

Problem with Additional Files to Include

Started by dagilleland on 6,860 views

Hi,

I'm evaluating nCrunch, and I'm having a bit of a problem with the Additional Files to Include. It doesn't seem to be pulling in the directories I want when the directory has a relative path that goes outside the project. Note that I am not referencing to get assemblies, per se, but to get a "sister project" (a project that sits alongside my testing project). Any insight you can offer would be appreciated!

Specifically, the line that doesn't seem to be working is this:

  <AdditionalFilesToInclude>\**.*;..\MyWebApplication\**.*</AdditionalFilesToInclude>


Essentially, I'm writing a solution to test customized build scripts in another project. My folder structure looks like this.
- Solution Folder
- - CustomBuildScript.Specifications
- - MyWebApplication


Here's my complete project ncrunch configuration file:

<ProjectConfiguration>
  <CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
  <ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
  <PreloadReferencedAssemblies>true</PreloadReferencedAssemblies>
  <AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
  <AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
  <IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
  <RunPreBuildEvents>true</RunPreBuildEvents>
  <RunPostBuildEvents>true</RunPostBuildEvents>
  <PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
  <InstrumentAssembly>true</InstrumentAssembly>
  <PreventSigningOfAssembly>false</PreventSigningOfAssembly>
  <AnalyseExecutionTimes>true</AnalyseExecutionTimes>
  <IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
  <DefaultTestTimeout>60000</DefaultTestTimeout>
  <UseBuildConfiguration></UseBuildConfiguration>
  <UseBuildPlatform></UseBuildPlatform>
  <ProxyProcessPath></ProxyProcessPath>
  <UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
  <IgnoredTests>
    <RegexTestSelector>
      <RegularExpression>DNNModuleBuildScript\.Specifications\.DebugBuildStory\..*</RegularExpression>
    </RegexTestSelector>
    <RegexTestSelector>
      <RegularExpression>DNNModuleBuildScript\.Specifications\.ReleaseBuildStory\..*</RegularExpression>
    </RegexTestSelector>
  </IgnoredTests>
  <AdditionalFilesToInclude>\**.*;..\MyWebApplication\**.*</AdditionalFilesToInclude>
</ProjectConfiguration>
Hi, thanks for posting!

Generally I would recommend against using the Additional Files To Include setting to reference files that belong to an adjacent project. Referencing files across projects breaks project atomicity and can create complex arrangements introducing issues that can be hard to track down. As the files are effectively owned by another project, the best practice is to reference this project from your test and use the location of it's built assembly inside the NCrunch test environment in order to find the files you need. There's an example of this that you might want to have a look at in the documentation.

Something else I often try to warn against is using broad wildcards in the 'Additional Files To Include' setting that may accidentally pick up files that are derived from the build process. You'll notice that when you do this, every time you build your solution, NCrunch will automatically kick off its own build. These wildcards can also result in abnormal runtime assembly referencing behaviour that can create some very obscure issues. A better approach is to try and include the necessary files in your project file, or use a more granular approach with the 'Additional files to include' so that the files derived from the build process (i.e. in bin\debug) are not included.

Checking the syntax shown above, it looks as though there is a bug with the configuration dialog used to set up the 'Additional files to include' setting. When choosing the directory containing the project, it will specify a syntax of '\**.*', which is basically trying to include all the files from your root directory upwards. The correct syntax is actually '**.*'. You can work around this by altering the config file you've shown above and specifying the correct syntax. I'll make a note to include a fix for this in an upcoming release. Thanks for reporting this problem!


Cheers,

Remco
For anyone interested, a fix for the above described configuration problem ('\**.*') has been introduced with the newly released version of NCrunch (v1.45).

Post a reply

Log in to reply.