单元测试仅在构建服务器上失败

时间:2022-03-16 20:19:17

It throws an exception that is something like this:

它抛出一个异常,如下所示:

Initialization method MyAssemblyA.Initialize threw exception. 
Spring.Objects.Factory.ObjectCreationException: Spring.Objects.Factory.ObjectCreationException: 

Error thrown by a dependency of object 'messageSource' defined in 'assembly    
[MyOtherAssembly.Test, Version=1.1.1016.1, Culture=neutral, PublicKeyToken=null], 
resource [MyOtherAssembly.context.xml] 

line 256' : Initialization of object failed : Could not load file or assembly 'MyAssemblyB' 
or one of its dependencies. The system cannot find the file specified.

I don't know exactly why, but a lot of the unit tests are failing only on the build server and the exception that is thrown is something similar to what I wrote above.

我不确切知道为什么,但很多单元测试只在构建服务器上失败,抛出的异常与我上面写的类似。

In my context.xml I have something like this:

在我的context.xml中,我有这样的事情:

    <object name="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
    <property name="resourceManagers">
      <list>
        <ref object="resMgrCoreServiceErrors"/>
        <ref object="resMgrPersonnelErrors"/>
      </list>
    </property>
  </object>

  <object name="resMgrCoreServiceErrors"
          type="Spring.Objects.Factory.Config.ResourceManagerFactoryObject, Spring.Core">
    <property name="baseName" value="MyOtherAssembly.Resources.ErrorRes"/>
    <property name="assemblyName" value="MyOtherAssembly"/>
  </object>

  <object name="resMgrPersonnelErrors"
          type="Spring.Objects.Factory.Config.ResourceManagerFactoryObject, Spring.Core">
    <property name="baseName" value="MyOtherAssemblyB.Resources.ErrorRes"/>
    <property name="assemblyName" value="MyOtherAssemblyB"/>
  </object>

where ErrorRes is a resource file (.resx).

其中ErrorRes是资源文件(.resx)。

Please help, any suggestions are welcomed !

请帮忙,欢迎任何建议!

1 个解决方案

#1


1  

are all of the dependencies of MyAssemblyB either installed in the gac or in the bin? has to be something in that vein.

MyAssemblyB的所有依赖项是安装在gac还是bin中?必须是那种静脉。

#1


1  

are all of the dependencies of MyAssemblyB either installed in the gac or in the bin? has to be something in that vein.

MyAssemblyB的所有依赖项是安装在gac还是bin中?必须是那种静脉。