在 TFS 2010 RC 构建期间如何处理具有相同文件名的两个程序集?
我遵循 CSLA.NET for Silverlight 模式,为业务对象程序集使用相同的文件名。例如:
CSLA.dll // .NET assembly
MyProject.Entities.dll // .NET assembly
CSLA.dll // Silverlight assembly
MyProject.Entities.dll // Silverlight assembly
这样做是为了您可以在 .NET 项目中使用单个代码文件,将其“文件链接”到 Silverlight 项目,并使两个程序集使用相同的代码(根据需要编译出 .NET 和 Silverlight 功能)。
相同程序集文件名的原因是 WCF 序列化绑定可以自动工作。
我遇到的问题是,我的构建服务器似乎将两个程序集放在同一输出目录(构建服务器上的 Binaries 文件夹)中,并使用该目录来解析项目引用,但它获取了错误的文件(Silverlight 的文件)而不是 .NET)。
有谁知道如何处理这种情况?
编辑:
我正在运行 TFS 2010 Beta2、VS 2010 RC1、Build Agent 2010 RC1
I am following the CSLA.NET for Silverlight pattern of using the same filename for the business objects assemblies. For example:
CSLA.dll // .NET assembly
MyProject.Entities.dll // .NET assembly
CSLA.dll // Silverlight assembly
MyProject.Entities.dll // Silverlight assembly
This is done so you can use a single code file in the .NET project, "file link" it to the Silverlight project and have both assemblies use the same code (compiling out the .NET and Silverlight functionally as needed).
The reason for the same Assembly file names is so that WCF serialization bindings just automatically work.
The issue I am having is that my build server seems to be putting both assemblies in the same output directory (the Binaries folder on the build server) and using that directory for resolving project references, but it is getting the wrong file (the Silverlight one instead of the .NET one).
Does anyone know how to deal with this situation?
EDIT:
I am running TFS 2010 Beta2, VS 2010 RC1, Build Agent 2010 RC1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我过去使用的策略是对两个项目使用相同的源目录,并将平台特定的文件嵌套在离散命名的子目录中,并且对于输出也使用相同的文件,例如 bin\debug\clr 和 bin\debug\sl。它需要对项目文件进行一些手动编辑,但似乎效果很好。我不记得构建服务器有任何问题。但我可能弄错了。
A strategy I have used in the past is to use the same source directory for both projects and nesting the platform specific files in discretely named subdirectories and the same for the output e.g. bin\debug\clr and bin\debug\sl. It requires a bit of manual editing of the project files but seemed to work well. I don't remember having any trouble with the build server. but I could be mistaken.
Aaron Hallberg 向我提到,您可以更改工作流程中的 MSBuild 活动以不设置
OutDir
。这有效,但导致 Binaries 文件夹无法获取输出的副本。相反,我所做的是在解决方案中创建三个构建配置:
ClrOnly
、SilverlightOnly
和WebsiteOnly
。然后,在构建定义的“进程”选项卡中,我将要构建的项目设置为构建“1 个项目和 3 个配置
”。现在二进制输出看起来像这样:我的单元测试和一切都工作得很好。
编辑:
另一方面,已发布的网站无效,因为它在构建和发布时选择了错误的引用。
Aaron Hallberg mentioned to me that you can change the MSBuild activity in the workflow to not set an
OutDir
. This worked, but caused the Binaries folder to not get a copy of the output.Instead, what I did was make three Build Configurations in the solution,
ClrOnly
,SilverlightOnly
, andWebsiteOnly
. Then in the Process tab of the build definition, I set the Items to Build to build "1 project(s) and 3 configuration(s)
". Now the Binaries output looks like this:And my unit tests and everything are working great.
EDIT:
The Published website on the other hand is invalid because it picks up the wrong references when it builds and publishes.