Build/Test Issues

NCrunch fails to build project / post build

Started by Queck on 3,667 views

Hi,

I am Using VS2017 and NCrunch 3.11.0.9
One of my test projects fails to build in NCrunch
As a error message I get (in short);
....Microsoft.Common.CurrentVersion.targets (5020, 5):
The command "CALL <myfirst.bat> ..... CALL "<my second.bat> exited with code 1.


This is due to a post-build-event of my test project in which I have two calls, each to a specific batch file.
As long as I only have one call in the post-build-event NCrunch has no problem.

Building the project with visual studio every thing works fine, the building as well as the execution of the batch files.
Also if I move the content of the second batch file into the first one and then have one call NCrunch has no problem with building the project an executing the batch.

Is there something I have to do special, if there are more than one batchfile calles in a post-build-event?

Best Regards
Rainer
Hi Rainer,

Thanks for sharing this problem.

By default, NCrunch will disable post build events because usually these involve logic that aren't required for tests to run.

Are these needed for your tests to be run on the project in question? Is it safe to simply disable them using the run post build event configuration setting?
Hi Remco,

I think the „right way“ to do this is found…

I realized that obviously a member of my team has already solved a similar issue.
Applying his solution also solved my problem.
Here is our currently working solution, please let me know if it meets the best practice approach:

In NCrunch-Project settings
  • Add Additional Files
    - Add the required DLLs
    - Add the batch files
  • Run post-build events enabled


Best Regards
Rainer

Edited

Hi Rainer,

I was about to ask whether the batch files were both included in the project :)

NCrunch doesn't change the way build events are executed, so my first guess as to why this is not working is that the batch files are not being copied to the workspace. By including them in the project or the 'Additional files to include' setting, NCrunch will be aware of them and will copy them accordingly.

Post a reply

Log in to reply.