将构建拆分为多个输出目录
我有一个使用 NServicebus 的解决方案,其中至少包含 3 个对此场景感兴趣的项目;发布者、扫描和网络服务。基本上,扫描会收集数据供发布者存储在数据库中,然后发布给订阅者。该网络服务允许访问存储在出版商数据库中的数据。
当我在开发盒上构建此解决方案并将其部署到测试环境时,一切都很好。上周,我们开始在构建服务器上使用自动构建,虽然构建成功,但服务无法在测试环境中启动。我发现这是因为 NServicesBus 使用标记接口。 NServicesBus 通用主机使用反射来检查与主机相同目录中的程序集是否有这些标记,以便它知道要启动哪个。与我的本地构建不同,构建服务器不会将每个项目构建到它自己的 bin 目录中,它只是将所有程序集转储到一个 bin 目录中。由于现在有多个类想要由宿主启动,所以不行。此外,Web 服务需要包含的程序集比发布者和扫描所需的程序集多得多,因此最终结果是将相同的程序集部署到三个不同的目录。这是不必要的,也不起作用。
我一直在像这样修改构建来解决这个问题,但它很乏味,而且不容忍更改:
<CreateItem Include="$(OutDir)*.*" Exclude="$(OutDir)BOHSweep*">
<Output ItemName="PublisherFilesToCopy" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="$(OutDir)*.*" Exclude="$(OutDir)InventoryPublisher*">
<Output ItemName="BOHSweepFilesToCopy" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="@(PublisherFilesToCopy)" DestinationFolder="\\XXXX\Transmittals\BOHPublisher\Test\%(RecursiveDir)" />
<Copy SourceFiles="@(BOHSweepFilesToCopy)" DestinationFolder="\\XXXX\Transmittals\BOHSweep\Test\%(RecursiveDir)" />
关于如何解决这个问题有什么优雅的建议吗?
I have a solution that uses NServicebus which contains at least 3 projects that are of interest for this scenario; a publisher, a sweep, and a webservice. Basically the sweep(s) gather data for the publisher to store in a database and then publish to subscribers. The webservice gives access to the data stored in the publishers database.
When I built this solution on my dev box and deployed to the test environment everything was fine. Last week we started using automated builds on a build server and while it builds successfully, the services would not start up in the test environment. I found this to be because NServicesBus uses marker interfaces. The NServicesBus generic host uses reflection to check assemblies in the same directory as the host for those markers so it knows which to fire up. Unlike my local build the build server does not build each project into it's own bin directory, it just dumps all the assemblies into a single bin directory. Since there are now multiple classes that want to be started by the host, it doesn't work out. Also, the webservice has a lot more assemblies to include than the publisher and sweep need so the end result is the same assemblies get deployed to three different directories. It's unnecessary and doesn't work.
I've been modifying the build like so to get around this, but it's tedious and it's not change tolerant:
<CreateItem Include="$(OutDir)*.*" Exclude="$(OutDir)BOHSweep*">
<Output ItemName="PublisherFilesToCopy" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="$(OutDir)*.*" Exclude="$(OutDir)InventoryPublisher*">
<Output ItemName="BOHSweepFilesToCopy" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="@(PublisherFilesToCopy)" DestinationFolder="\\XXXX\Transmittals\BOHPublisher\Test\%(RecursiveDir)" />
<Copy SourceFiles="@(BOHSweepFilesToCopy)" DestinationFolder="\\XXXX\Transmittals\BOHSweep\Test\%(RecursiveDir)" />
Any elegant suggestions on how to tackle this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够使用此处找到的技术:http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/07/preserving-output-directory-structs-in-orcas-team-build。 ASPX
You should be able to use the technique found here: http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/07/preserving-output-directory-structures-in-orcas-team-build.aspx