【发布时间】:2020-01-14 13:20:24
【问题描述】:
我知道有人问过这个问题,但我已经尝试了所有我能找到的建议解决方案。
我有一个负载测试项目(带有一个从 Microsoft.VisualStudio.TestTools.WebTesting.WebTest 继承的 .loadtest 文件和类)。它必须针对 .Net Framework(4.6.1 版)而不是 .Net Core。
它引用了一个以 .Net Standard 2.0 为目标的项目,并且加载项目和 .Net Standard 项目都添加了 System.ComponentModel.Annotations(版本 4.5.0)Nuget 包。
当我尝试运行负载测试本身时,我收到以下异常:
System.IO.FileNotFoundException
Message=Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我尝试将 app.config 文件添加到具有绑定重定向的负载测试项目中,但对异常没有影响。
我无法下移到 NuGet 包的 4.4.1 版本,因为其他地方的其他项目依赖它是 4.5 版本。
I have read that there is a problem with the versioning in this package。事实上,当我检查构建的 .Net Standard 项目 dll 的依赖项时,它似乎不是指定的 4.5.0,而是版本 4.2.0.0。
现在我可以通过删除 NuGet 包引用并在 Packages 文件夹中添加对 dll 的手动引用来强制项目为正确的版本(似乎是 4.2.1.0),然后是另一个项目链拒绝接受我给它的hintPath,并默认为不同的位置和版本:
所以我不能强制我需要的所有项目都使用我想要的 dll 的实际版本和位置。
只是想知道是否有人可以提出任何可能对这里有所帮助的行动方案,因为我对如何强制整个事情使用正确的版本有点茫然。通过绑定重定向,或者让所有项目接受我提供的 dll 路径。
【问题讨论】:
-
注意“...或其依赖项之一”。在错误消息中。您可能会发现 fuslogvw 很有帮助。
标签: .net load-testing system.componentmodel assemblyversions