在C ++ / CLI项目中使用代码约定 [英] Using Code Contracts in a C++ / CLI project

查看:90
本文介绍了在C ++ / CLI项目中使用代码约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"代码合同"用户手册指出合同重写器适用于任何托管程序集。但是,VS插件仅支持C#和VB项目。鉴于从VS2010开始,C ++ CLI也使用MSBuild,在C ++ / CLI项目中应该很容易使用Code Contracts。
很遗憾,我没有编辑MSBuild文件的经验。有人能告诉我如何在C ++ / CLI项目中使用代码契约吗?

The Code Contracts user manual states that the contracts rewriter works with any managed assembly. However, the VS plugin only supports C# and VB projects. Given that as of VS2010, C++ CLI also uses MSBuild, it should be easy to use Code Contracts in a C++/CLI project.

Sadly, I have no experience editing MSBuild files. Can anybody tell me how to use Code Contracts in a C++/CLI project?

推荐答案

原则上你是对的,但我们的工具尚未经过测试C ++ / CLI程序集。静态检查器似乎可能有效,但重写器会为它们生成错误的元数据。

In principle you are right, but our tools have not been tested on C++/CLI assemblies. The static checker seems to work possibly, but the rewriter generates bad metadata for them.

很明显,最终我们必须支持这一点。一个复杂因素是VC ++ / CLI的构建与CS或VB的构建完全不同。所以这必须专门为C ++ / CLI重做。

It is clear that eventually we will have to support this. One complication is that the build for VC++/CLI is quite different than the build for CS or VB. So this has to be redone specially for the C++/CLI.

 


这篇关于在C ++ / CLI项目中使用代码约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆