Build/Test Issues

Configuration option "Additional files to include" doesn’t work

Started by AlexanderUK on 6,390 views

The configuration option “Additional files to include” doesn’t work.

Repro steps:

1. Create three projects: console application, class library and test project.
2. Add into console application project new “appsettings.json” file. And in property page of “appsettings.json” it is necessary to set up “Copy to Output Directory” option as “Copy always”.
3. The class library project has “Method1” which reads settings from “appsettings.json” of console application project.
4. Test project has one test which is testing “Method1” from the class library.
5. Unfortunately, test fails. It happens because “appsettings.json” file isn’t copied to the folder with tests.
6. Even if NCrunch Configuration for Test project has configured option “Additional files to include” as “..\console application\appsettings.json” it doesn’t help.

Each project is builded by NCrunch in separate folder, that’s why there is no possibility to copy files from one project to project with tests. NCrunch copies only exe and dll files into folder with tests.

Visual Studio 2017 version 15.5.6
NCrunch version 3.12.0.15

Can somebody help me with this problem?
Hi, thanks for sharing this problem.

This is a technical limitation caused by NCrunch's build optimisations. You need to either change the way this file is located by your code so that it searches relative to the console project's .exe, or you need to turn on the 'Copy referenced assemblies to workspace' setting for the projects involved. See for more information: http://www.ncrunch.net/documentation/considerations-and-constraints_assembly-colocation-assumptions.
Thanks a lot. It really helped. As workaround it works!

Post a reply

Log in to reply.