Worth noting is that the project does have a dll file in the NCrunch workspace so the build seems to work?
>Does the project build correctly in NCrunch if you turn off the 'Allow dynamic code contract checking' option in your NCrunch project-level configuration?
Yes
>What happens if you enable the 'Allow static code contract checking' option?
Same error
>When you built your project via the command prompt with msbuild.exe, did you need to inject any extra properties (such as 'Configuration')?.
Yes (msbuild MYSOLUTION.sln /p:"platform=any cpu" /p:"configuration=debug ncrunch")
>Something also worth trying is to run the command line MSBuild inside the workspace NCrunch has built for your project, against the .proj file that NCrunch has generated for the build.
Hrm in the workspace I get error below. The repositories project is referencing the DataModel project, which in turn has a reference to Iesi.Collections.
So the workaround I use now is referencing Iesi.Collections within the Repositories project as well. Thanks.
Quote:
Build started 2012-07-10 07:23:21.
Project "C:\Users\MYUSER\AppData\Local\NCrunch\6500\25\Infrastructure\APPNAME.Infrastructure.Repositories\APPNAME.Infrastructure.Repositories.csproj" on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CodeContractRewrite:
"C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite" "@APPNAME.Infrastructure.Repositoriesccrewrite.rsp"
Reading assembly 'APPNAME.Domain.DataModel' from 'C:\Users\MYUSER\AppData\Local\NCrunch\6500\5\Domain\APPNAME.Domain.DataModel\bin\Debug NCrunch\APPNAME.Domain.DataModel.dll' resulted in errors.
Assembly reference not resolved: Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
Could not resolve type reference: [Iesi.Collections]Iesi.Collections.Generic.ISet`1.
ccrewrite : error : Rewrite aborted due to metadata errors. Check output window [C:\Users\MYUSER\AppData\Local\NCrunch\6500\25\Infrastructure\APPNAME.Infrastructure.Repositories\APPNAME.Infrastructure.Repositories.csproj]
elapsed time: 3512,2009ms
C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(245,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite" "@APPNAME.Infrastructure.Repositoriesccrewrite.rsp"" exited with code -1. [C:\Users\MYUSER\AppData\Local\NCrunch\6500\25\Infrastructure\APPNAME.Infrastructure.Repositories\APPNAME.Infrastructure.Repositories.csproj]
Done Building Project "C:\Users\MYUSER\AppData\Local\NCrunch\6500\25\Infrastructure\APPNAME.Infrastructure.Repositories\APPNAME.Infrastructure.Repositories.csproj" (default targets) -- FAILED.
*Edit: But now the nCrunch.TestHost.x86.exe starts crashing for tests where the code contracts throw System.Diagnostics.Contracts.__ContractsRuntime+ContractException .