MaPi
MaPi

Reputation: 1601

Error while adding a Fakes in VS 2012

I have VS 2012 Ultimate and I am trying to add a Fake. I right click on a referenced assembly, choose "Add Fakes assembly".

But then I cannot build the project, I get this error:

Error 1 The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite.exe" "@fccrewrite.rsp"" exited with code -1. [\vmware-host\Shared Folders\Documents\tfs\DefaultCollection\xxx\Workflow.Test\obj\Debug\Fakes\mxs\f.csproj] Workflow.Test

Upvotes: 2

Views: 208

Answers (1)

pixelbadger
pixelbadger

Reputation: 1596

This error is coming from the Code Contracts rewriter, which has (or had) a bug that prevents it from working over UNC paths.

This is due to an escape-conversion bug that converts the leading \\ to a \. You might notice that the path in square brackets starts with a single slash: [\vmware-host\Shared...

The workaround provided in the link above is to map a drive to the UNC path, and reference your project from that drive.

I should also point out that the link is from 2011. Things might have changed in newer versions of the Code Contracts extension, but I can confirm this issue was still present when I evaluated Code Contracts in the middle of 2014.

As has been pointed out in a comment, you can probably disable the rewriter for your Fakes assembly - I can't see why you'd need it there.

Upvotes: 4

Related Questions