简体   繁体   English

无法在类库项目中加载程序集“ Microsoft.Expression.Encoder”或其依赖项之一以进行单元测试

[英]Could not load assembly 'Microsoft.Expression.Encoder' or one of its dependencies in class library project for unit testing

I need to unit/integration test my web application using selenium so I need to record the screen. 我需要使用硒对Web应用程序进行单元/集成测试,因此需要记录屏幕。 I have written it down in global setup and global tear down as: 我在全局设置和全局拆卸中将其记录为:

    public void GlobalSetup()
            {
                SetupExtentReport();

                // Create a instance of ScreenCaptureJob
                PropertiesCollection.Recorder = new ScreenCaptureJob();

                // Specify the path & file name in which you want to save         
                PropertiesCollection.Recorder.OutputScreenCaptureFileName = @"C:\ScreenRecording.wmv";

                // Start the Screen Capture Job
                PropertiesCollection.Recorder.Start();

//remaining code
    }

and in tear down 并在拆除

    public void GlobalTearDown()
            {
                try
                {
                    //close extent reports
                    PropertiesCollection.ExtentReport.Flush();
                    PropertiesCollection.ExtentReport.Close();

                    //stop recorder
                    PropertiesCollection.Recorder.Stop();


                Console.WriteLine("Finished All Tests");
            }
}

But my test does not debug and this error comes in test explorer. 但是我的测试无法调试,并且该错误来自测试资源管理器。

Could not load assembly 'Microsoft.Expression.Encoder version=4.0.0 ........ ' or one of its dependencies. 无法加载程序集“ Microsoft.Expression.Encoder版本= 4.0.0 ........”或其依赖项之一。 An attempt was made to load a program with an incorrect format. 试图加载格式错误的程序。

I have been using Expression Encoder assembly referenced from installed folder. 我一直在使用从已安装文件夹引用的Expression Encoder程序集。

Note: My project is simple class library project 注意: 我的项目是简单的类库项目

This is a question which I viewed but it did not help me: Could not load file or assembly 'Microsoft.Expression.Encoder' 我查看了这个问题,但没有帮助我: 无法加载文件或程序集“ Microsoft.Expression.Encoder”

I went through certain questions but in my case it's library project and cannot convert to 32-bit/64-bit since I am not on IIS. 我遇到了一些问题,但就我而言,它是库项目,由于我不在IIS上,因此无法转换为32位/ 64位。

我需要将构建平台目标从“任何CPU”更改为“ x86”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“Microsoft.Expression.Encoder” - Could not load file or assembly 'Microsoft.Expression.Encoder' 程序集加载错误 - > 无法加载文件或程序集“Microsoft.SqlServer.Types,版本 = 10.0.0.0”或其依赖项之一 - Assembly Load Error - > Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0' or one of its dependencies 无法加载文件或程序集或其依赖项之一 - Could not load file or assembly or one of its dependencies 无法加载文件或程序集或其依赖项之一 - could not load file or assembly or one of its dependencies 无法加载文件或程序集或其依赖项之一 - Could not load file or assembly or one of its dependencies 无法加载文件或程序集''或其依赖项之一 - Could not load file or assembly '' or one of its dependencies 无法加载文件或程序集及其依赖项之一 - Could not load file or assembly and one of its dependencies 无法加载或组装或其依赖项之一 - Could not load or assembly or one of its dependencies 无法加载文件或程序集“ Microsoft.AspNet.Scaffolding.12.0”或其依赖项之一 - Could not load file or assembly 'Microsoft.AspNet.Scaffolding.12.0' or one of its dependencies 无法加载文件或程序集“Interop.Microsoft.Office.Interop.Word”或其依赖项之一 - Could not load file or assembly 'Interop.Microsoft.Office.Interop.Word' or one of its dependencies
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM