代码合约重写失败 - libpaths 顺序

发布于 2024-10-02 03:32:32 字数 909 浏览 1 评论 0原文

我的解决方案/项目在关闭该特定项目的代码合同的情况下构建良好。

当我在项目上打开执行运行时合同检查时,构建失败。 CC 重写器开始发出数百条消息,内容如下:

无法解析成员引用:...

看来此问题是由通过传递给 ccrewrite 的项目引用的顺序引起的。 libpaths 参数。当我将构建拆开并在命令行上运行它,并以特定顺序手动指定对 libpaths 的引用时,ccrewrite 起作用,并且构建完成。

例如

ccrewrite /level:4 /rewrite "/ assemblyMode=standard" / throwonfailure /libpaths:"XY Z" "target.dll" -- 失败 :(

ccrewrite /level:4 /rewrite "/ assemblyMode = standard" / throwonfailure / libpaths:" ZY X" " target.dll" -- 编译/重写:)

这对我来说有点奇怪,我认为 ccrewrite 应该能够处理任意顺序,特别是因为提供的“损坏”顺序是 msbuild 传递给 Microsoft.CodeContracts.targets 文件/ccrewrite 的顺序,但这对 CC 人员来说是一个问题。我还在 3 台不同的机器上对此进行了测试,结果相同,因此它要么是 ccrewrite 问题,要么是 ccrewrite 不喜欢的特定 csproj 中的奇怪内容。

我想知道的是,我能否确保我的参考项目的特定顺序,沿着链传递到 CC 目标文件?我本以为构建引擎将使用它在 ItemGroup//ProjectReference 元素下的项目 csproj 文件中读取的顺序,但事实并非如此。

有什么想法吗?

My Solution/Project builds fine with code contracts turned off for this particular project.

When I turn on Perform Runtime Contract Checking on my project, the build fails. The CC rewriter starts to kick up hundreds of messages along the lines of:

Could not resolve member reference: ....

It seems this problem is caused by the order of the project references passed to ccrewrite via the libpaths argument. When I pull the build apart, and run it on the command line, and I manually specify the references in a specific order to libpaths, ccrewrite works, and the build completes.

eg

ccrewrite /level:4 /rewrite "/assemblyMode=standard" /throwonfailure /libpaths:"X Y Z" "target.dll" -- fails :(

ccrewrite /level:4 /rewrite "/assemblyMode=standard" /throwonfailure /libpaths:"Z Y X" "target.dll" -- compiles/rewrites :)

This seems a little odd to me, I'd have thought ccrewrite should be able to handle an arbitrary ordering, especially since the provided 'broken' ordering is the one msbuild is passing along to the Microsoft.CodeContracts.targets file / ccrewrite, but thats an issue for the CC guys. I've also tested this on 3 different machines, with the same result, so its either a ccrewrite issue, or something odd in this specific csproj that ccrewrite doesnt like.

What I'm wondering is, can I ensure the specific ordering of my reference projects, that get passed along the chain to the CC targets file? I would have assumed that the build engine would use the order it reads in the project csproj file, under ItemGroup//ProjectReference elements, but its not the case.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清眉祭 2024-10-09 03:32:32

这是已识别错误已在该工具中解决,并已在最新版本 v1.4.31130.0 2010-11-30 中得到解决。

This was an identified error in the tool, and has been resolved in the latest release, v1.4.31130.0 2010-11-30.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文