gpt4 book ai didi

c# - Microsoft 代码契约(Contract) : Error "CodeContracts: Diagnostic: Failed to connect to any cache."

转载 作者:太空狗 更新时间:2023-10-29 18:20:07 25 4
gpt4 key购买 nike

运行 Microsoft Code Contracts 时出现以下错误:

CodeContracts: Diagnostic: Failed to connect to any cache.

最佳答案

user manual for Code Contracts状态:

Cache results: Controls if the analysis results are cached. If checked, the analysis tries to avoid analyzing methods whose outcomes cannot possibly change (because no contracts, no code, and no relevant metdata has changed). Enabling this option allows for faster turn-around times if using the static checker repeatedly. To share the cache among multiple developers, use a SQL server and put the server name in the SQL Server conguration box in the UI. Note: the SQL server connection uses Windows authentication to log onto the server. Your developers will need the right to create and modify databases.

找出您机器上安装的 SQL Server 的正确名称(注意“localhost”不起作用;它必须是实际的机器名称):

enter image description here

右键单击项目,选择“属性”,转到“代码契约(Contract)”选项卡(列表底部),然后添加您的机器名称:

enter image description here

这适用于版本 1.5.60911.10(2013 年 9 月 11 日)。也许 future 版本的 Code Contracts 将尝试连接到“localhost”和/或在此框中接受“localhost”,和/或自动检测 SQL Server 2012。

在我的特殊情况下,我没有安装“(localdb)\V11.0”;如果我已经安装了它,那么它就会开箱即用(它必须在内部默认为这个)。

关于c# - Microsoft 代码契约(Contract) : Error "CodeContracts: Diagnostic: Failed to connect to any cache.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23450183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com