Microsoft Office PIA 以及如何从 WebApp 正确引用和构建
我目前正在尝试在 TeamCity 上构建,它使用 Microsoft.Office.Interop dll。 当我安装了 Office 时,这将在本地构建并正常工作,但是当尝试在 TeamCity 上构建它时,它会失败,因为它没有引用。
我无法安装 PIA 分发版,因为收到一条错误消息,指出需要安装 Office 2003。 我不想在服务器上安装 Office。
有什么办法可以解决这个问题吗?
I am currently trying to build on TeamCity, which uses Microsoft.Office.Interop dll. This will build and work fine locally as I have Office installed, however when trying to build it on TeamCity it fails as it has no reference.
I can't install the PIA distributable as I get an error message saying the Office 2003 is required to be installed. I don't want to install Office on the server.
Is there any way to get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 teamcity 服务器所做的只是构建,则将 Microsoft.Office.Interop DLL 添加到项目的引用文件夹中,然后将项目配置为在该引用文件夹中查找。
但是,如果 TeamCity 服务器也在运行使用 Office Interop 的测试,那么除非在运行测试的计算机上安装了 Office,否则您将遇到问题。
If all the teamcity server is doing is a build, then add the Microsoft.Office.Interop DLL to a References folder for your project, and then configure your project to look in that references folder.
However, if the TeamCity server is also running tests that use Office Interop, then you will run into problems unless you have Office installed on the machine running the tests.
事实并非如此 - Interop dll 只是 .NET 代码和实际 (COM) Office 代码之间的一个 thunk 层。 如果您的 Interop dll 没有底层 Office dll,则对 Interop 的任何调用都将失败,因为 Interop 将要调用它使之可互操作的 COM 对象。
这些 COM 对象是 Office 对象,因此您需要安装 Office 的某些部分。
Not really - the Interop dll is only a thunk layer between your .NET code and the actual (COM) Office code. If you have the Interop dll without the underlying Office dll, then any calls into the Interop will fail because the Interop will want to call the COM objects it's making interoperable.
Those COM objects are Office objects, so you will need some part of Office installed.