简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM