1. <i id='dr63o'><tr id='dr63o'><dt id='dr63o'><q id='dr63o'><span id='dr63o'><b id='dr63o'><form id='dr63o'><ins id='dr63o'></ins><ul id='dr63o'></ul><sub id='dr63o'></sub></form><legend id='dr63o'></legend><bdo id='dr63o'><pre id='dr63o'><center id='dr63o'></center></pre></bdo></b><th id='dr63o'></th></span></q></dt></tr></i><div id='dr63o'><tfoot id='dr63o'></tfoot><dl id='dr63o'><fieldset id='dr63o'></fieldset></dl></div>

    1. <tfoot id='dr63o'></tfoot>
    2. <small id='dr63o'></small><noframes id='dr63o'>

      • <bdo id='dr63o'></bdo><ul id='dr63o'></ul>

      <legend id='dr63o'><style id='dr63o'><dir id='dr63o'><q id='dr63o'></q></dir></style></legend>
    3. 在构建服务器上使用 Microsoft.Office.Interop dll 进行单元测试失败

      时间:2023-07-26

      <small id='loKlS'></small><noframes id='loKlS'>

    4. <i id='loKlS'><tr id='loKlS'><dt id='loKlS'><q id='loKlS'><span id='loKlS'><b id='loKlS'><form id='loKlS'><ins id='loKlS'></ins><ul id='loKlS'></ul><sub id='loKlS'></sub></form><legend id='loKlS'></legend><bdo id='loKlS'><pre id='loKlS'><center id='loKlS'></center></pre></bdo></b><th id='loKlS'></th></span></q></dt></tr></i><div id='loKlS'><tfoot id='loKlS'></tfoot><dl id='loKlS'><fieldset id='loKlS'></fieldset></dl></div>
      <tfoot id='loKlS'></tfoot>
      • <bdo id='loKlS'></bdo><ul id='loKlS'></ul>
              <tbody id='loKlS'></tbody>
            <legend id='loKlS'><style id='loKlS'><dir id='loKlS'><q id='loKlS'></q></dir></style></legend>

                本文介绍了在构建服务器上使用 Microsoft.Office.Interop dll 进行单元测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我写了一个单元测试.被测代码引用了 Microsoft.Office.Interop.Excel.dll.

                I've written a unit test. The code under test references Microsoft.Office.Interop.Excel.dll.

                测试在我的机器上运行良好,但在构建服务器上失败.它在 Excel 应用程序被实例化的那一行失败:

                The test runs fine on my machine but fails on the build server. It fails on the line where the Excel application is instantiated:

                var application = new Application { Visible = Visible };
                

                错误是:

                System.Runtime.InteropServices.COMException: 
                Retrieving the COM class factory for component with CLSID 
                {00024500-0000-0000-C000-000000000046} failed due to the following error:
                80040154 Class not registered
                

                这是否意味着我必须在我的构建服务器上安装可再发行主互操作程序集?如果是这样,我是否还需要在构建服务器上安装 Excel?

                Does this mean I have to install the Redistributable Primary Interop Assemblies on my build server? And if so, do I also need to install Excel on the build server?

                Microsoft.Office.Interop.Excel.dll 包含在我的解决方案中,并从那里引用.

                Microsoft.Office.Interop.Excel.dll is included in my solution and it is referenced from there.

                推荐答案

                您需要为该版本安装 Office 和主互操作程序集,或 Visual Studio 才能使其正常工作.在 CI 环境中运行时您可能会遇到 COM 问题,如果您可以重组测试以避免使用 Office Interop,我强烈推荐它.

                You'll need to install Office and the Primary Interop Assemblies for that version, or Visual Studio to get this to work. You might run into COM issues with running in a CI environment, and if you can restructure your tests to avoid using Office Interop, I'd highly recommend it.

                这篇关于在构建服务器上使用 Microsoft.Office.Interop dll 进行单元测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何获取打开的资源管理器窗口的 PIDL? 下一篇:将反射与 COM 互操作一起使用

                相关文章

                <i id='yADJS'><tr id='yADJS'><dt id='yADJS'><q id='yADJS'><span id='yADJS'><b id='yADJS'><form id='yADJS'><ins id='yADJS'></ins><ul id='yADJS'></ul><sub id='yADJS'></sub></form><legend id='yADJS'></legend><bdo id='yADJS'><pre id='yADJS'><center id='yADJS'></center></pre></bdo></b><th id='yADJS'></th></span></q></dt></tr></i><div id='yADJS'><tfoot id='yADJS'></tfoot><dl id='yADJS'><fieldset id='yADJS'></fieldset></dl></div>
                1. <tfoot id='yADJS'></tfoot>
                  <legend id='yADJS'><style id='yADJS'><dir id='yADJS'><q id='yADJS'></q></dir></style></legend>
                  • <bdo id='yADJS'></bdo><ul id='yADJS'></ul>

                    <small id='yADJS'></small><noframes id='yADJS'>