无法在VSTS上加载文件或程序集' Microsoft.Owin.Host.SystemWeb

时间:2017-03-07 07:43:19

标签: msbuild azure-devops azure-pipelines

本地我所有的测试运行正常,但是当在VSTS上进行构建时,我收到此错误。

##[error]System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Owin.Host.SystemWeb, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.

虽然nuget恢复构建步骤说:

Restoring NuGet package Microsoft.Owin.Host.SystemWeb.3.0.1.

Adding package 'Microsoft.Owin.Host.SystemWeb.3.0.1' to folder 'D:\a\1\s\packages'
Added package 'Microsoft.Owin.Host.SystemWeb.3.0.1' to folder 'D:\a\1\s\packages'

1 个答案:

答案 0 :(得分:0)

我通过添加这个虚拟类

来实现它
 public class Dummy
 {
     internal void LoadThisAssembly()
     {
         Microsoft.Owin.Host.SystemWeb.OwinHttpHandler httpHanlder = new Microsoft.Owin.Host.SystemWeb.OwinHttpHandler();           
     }
 }

我想测试项目不会复制程序集,除非它实际被使用