My Solution / Project works great with disabled code contracts for this particular project.
When I enable runtime execution checking in my project, the build fails. The CC script begins to drop hundreds of messages line by line:
Could not resolve member reference: ....
This problem seems to be caused by the order of the project references passed to ccrewrite with an argument libpaths. When I pull out the construct separately and run it on the command line, and I manually point out the links in a specific order to libpaths, ccrewrite works and build completes.
eg,
ccrewrite /level:4 /rewrite "/assemblyMode=standard" /throwonfailure /libpaths:"X Y Z" "target.dll" -- fails :(
ccrewrite /level:4 /rewrite "/assemblyMode=standard" /throwonfailure /libpaths:"Z Y X" "target.dll" -- compiles/rewrites :)
This seems a little strange to me, I would think that ccrewrite should be able to handle arbitrary ordering, especially since the provided “broken” order is the one that msbuild passes along with the Microsoft.CodeContracts.targets / ccrewrite file, but this is a problem for guys CC. I also tested this on three different machines with the same result, so its either a ccrewrite problem, or something strange in this particular csproj that ccrewrite doesn't like.
What interests me is, can I provide a specific order for my link projects that are chained to the target CC file? I would suggest that the build engine will use the order that it reads in the csproj project file under the elements ItemGroup//ProjectReference, but that is not the case.
Any ideas?