English 中文(简体)
How can I use Code Contracts in a C++/CLI project?
原标题:

I recently stumbled upon Code Contracts and have started using them in my C# projects. However, I also have a number of projects written in C++/CLI.

For C# and VB, Code Contracts offer a handy configuration panel in the project properties dialog. For a C++/CLI project, there is no such panel.

From the documentation, I got the impression that adding Code Contracts support to a C++/CLI project should be a simple matter of calling some external tools as part of the build process (namely ccrefgen.exe, cccheck.exe, and ccrewrite.exe). However, the number of command line options and restrictions concerning the call sequence have me somewhat intimidated.

Can anybody point me to a simple way to run the Code Contracts tools as an automated part of the build process in Visual Studio?

问题回答

I arrived at this stackoverflow page because I am searching for the same answers that the original poster is looking for. So far, my searches seem to indicate that "Code Contracts" per se are not available for C++ native code. However, there is something similar called "VC++ (Visual C++) source annotations".

Try the following links:

http://dotnetslackers.com/articles/net/code-contracts.aspx#visual-c-source-annotations

http://social.msdn.microsoft.com/Forums/en/vstscode/thread/db48da4d-fc93-4e99-99cc-22d47c5838e9





相关问题
How can I overwrite file web.config with web.other.config?

I have a msbuild script with custom logic to deploy my service to the qa server automatically. I have to overwrite the default config with a dedicated one, but when I use <Copy SourceFiles="web....

How do I use MSBuild on a C# project with no compilable code

I have a C# web app project which actually has no ASP.Net or C# in it. It s just a single html page with some Javascript, CSS, and a couple of images. I want to use MSBuild to deploy a version of ...

您能否防止MSBuild.exe经营活动?

我用文字建造一些项目,偶尔利用习俗制造事件,给建筑系统造成了很大困难。 如果有可能,我想援引MSBuild.exe。

building .net applications without Visual Studio

I m interested to hear about people working with building .net applications using MSBuild, NAnt or similar tools. What are you using, why are you using it instead of the VS IDE? I like to use ...

How long does my Visual Studio C# compile take?

It seems like it should be possible to configure Visual Studio to print out how long the compile takes. Perhaps somewhere in the .sln file. If the sln is compiled from the command line using ...

热门标签