NCrunch fails to build a project that includes a NSwag build step.
I don't know much about the ms build process. Perhaps you can suggest how I may proceed.
thanks
joe
To reproduce:
Download repository at https://github.com/jasontaylordev/CleanArchitecture.git, e1abd2eec1e55d00b0abeb49dd9f7285310ca26d 4 Aug 2020.
Install latest .net core sdk
Install latest Node.js LTS
Open solution in VS2019 16.6.5
Build solutions (the first Node build takes a few minutes)
Enable NCrunch.
Ncrunch starts building (this takes a couple of minutes) but fails to build the WebUI project
To fix:
Comment out the NSWag target from the WebUI.csproj file
Close VS2019
Reopen solution in VS2019
Rebuild the solution
NCrunch now builds the WebUI project successfully.
Failure output from NCrunch
EXEC (0, 0):
The command "dotnet "C:\Users\joe\.nuget\packages\nswag.msbuild\13.7.0\build\../tools/NetCore31/dotnet-nswag.dll" run /variables:Configuration=Debug" exited with code -1.
The problem here is that the command line call to NSwag is causing runtime code within user assemblies to be executed at build time. There is no way we will feasibly get such a structure to run reliably under NCrunch.
To work around this, you need to disable your custom NSwag build target for NCrunch builds. To do this, simply extend the condition on the target to take NCrunch into consideration, as such: