开发者

MS Build dual assemblies for x86 and x64 builds and TeamCity

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.


References can be made conditional in your project file (I'm making up the details of the references below).

<Reference
  Include="SQLLite"
  Condition="'$(Platform)' == 'x64'">
  <HintPath>PathTo/x64/SqlLite.dll"</HintPath>
</Reference>
<Reference
  Include="SQLLite"
  Condition="'$(Platform)' == 'Win32'">
  <HintPath>PathTo/Win32/SqlLite.dll"</HintPath>
</Reference>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜