c# - Visual Studio Express 2013 中的代码契约(Contract)支持

标签 c# .net visual-studio-2013 visual-studio-express code-contracts

我一直在 Visual Studio Express 2013 中开发 C# 项目并遇到了 Code Contracts对于 .NET 语言。它们的简洁和附带的静态分析工具给我留下了深刻的印象,我开始在我的代码库中使用它们。然而,当我试图运行我的程序时,我遇到了一条类似于 this SO thread 中的错误消息。 ,即

...An assembly (probably "<my project>") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.Requires and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild...

指南建议要解决此问题,我必须从项目的“属性”页面启用代码契约,但在 Express 中找不到代码契约属性条目。

Some MSDN forum threads似乎表明代码契约(Contract)的所有工具都包含在 Express 版本中,但代码契约(Contract)属性页面不包含。情况似乎是这样,因为只有在使用我毕业前从大学获得的 Visual Studio 2012 Ultimate 副本启用代码契约(Contract)后,我才能在 VSE 2013 中运行我的项目。

除了手动修改项目文件或使用付费版本的 Visual Studio 之外,真的没有办法在 Visual Studio Express 中使用代码契约(Contract)吗?如果是这种情况,我会非常犹豫是否要使用它们,因为我的公司不太可能购买 VS 许可证。此外,微软试图推广这种新的、更高级的验证范例,但随后将其仅限于付费客户,这似乎非常奇怪。

最佳答案

只要满足许可要求,您就可以使用新的 VS Community 2013: http://www.visualstudio.com/en-us/visual-studio-community-vs

Here’s how Visual Studio Community can be used in organizations:

An unlimited number of users within an organization can use Visual Studio Community for the following scenarios: in a classroom learning environment, for academic research, or for contributing to open source projects.

For all other usage scenarios: In non-enterprise organizations, up to 5 users can use Visual Studio Community. In enterprise organizations (meaning those with >250 PCs or > $1 Million US Dollars in annual revenue), no use is permitted beyond the open source, academic research, and classroom learning environment scenarios described above.

它基本上是免费的 VS 2013 Professional,因此您可以安装代码契约(Contract)扩展。

关于c# - Visual Studio Express 2013 中的代码契约(Contract)支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24729398/

相关文章:

c# - 如何更新 "updater"? (C#)

c++ - std::error_category 可以跨 dll 使用吗?

c - 测试运行 null 和字母?

c# - 在 c# 中加载 1000 张图像而不会出现内存不足异常

c# - 如何遍历 PDFSharp 中的 Pdf 对象树?

c# - 属性可以引用嵌入式资源吗?

c# - 使用 DirectoryServices.AccountManagement 从 OU 获取组

c# - 将 MenuItem 与列表中的项目动态关联

c# - 来自 native 应用程序的 CoCreateInstance C# COM 组件找不到引用

c++ - OpenCV - FindContours - Projekt.exe 已触发断点