适用于 x86 和 x64 构建以及 TeamCity 的 MS Build 双程序集
我最近在尝试使用 Fluent Nhibernate 运行 SQLLite 支持的内存存储库模拟(存储库模式)时遇到了一些问题。当我在 Windows Server 2008 上针对 (TeamCity) 构建代理运行测试时,测试失败并出现无法加载 System.Data.SQLite 异常。
经过一番摆弄后,我记得下载的 SqlLite 二进制文件中有一个 x64 版本的 System.Data.SQLite。将其放在单元测试的程序集旁边并通过 NUnit UI 运行测试是有效的,并且不再引发任何异常。
我的问题是:是否可以告诉构建类似:在 x64 系统上编译时,从文件夹 B 引用二进制文件,而在 x86 系统上,从文件夹 A 引用二进制文件?那么条件参考包括什么?
我现在能想到的唯一其他选择是将 TeamCity 构建代理限制为 x64,并使用命令行脚本构建步骤在构建完成 ant 单元测试运行之间覆盖 bin\Release 文件夹中的程序集。开发环境都是x86,所以这是问题的根源。
写这个还有另一种选择 - 但很混乱 - 在下载 svn 构建源之后和使用脚本运行构建之前修改项目文件。
I've recently had a few issues when trying to run SQLLite powered in-memory repository mock (Repository pattern) with Fluent Nhibernate. When I ran the tests against a (TeamCity) build agent on Windows Server 2008 the tests were failing with unable to load System.Data.SQLite exceptions.
After some fiddling I remembered there was a x64 version of System.Data.SQLite in the downloaded SqlLite binaries. Dropping that next to unit tested assembly and running tests through NUnit UI worked and no longer threw any exceptions.
My question is: is it possible to tell the build something like: when compiling on x64 system, reference the binary from folder B and when on x86 system, from folder A? So a conditional reference include?
The only other option I can think of right now is to limit TeamCity build agents to be x64 and use a command line script build step to overwrite assembly in bin\Release folder in between build finishing ant unit tests running. Development environments are all x86 so that's the root of the issue.
Writing this there is one other option - but a messy one - modify the project file after svn build source is downloaded and before the build runs using a script.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以在您的项目文件中设置有条件的引用(我正在编写下面的引用的详细信息)。
References can be made conditional in your project file (I'm making up the details of the references below).