【发布时间】:2018-05-11 14:07:54
【问题描述】:
场景:作为逻辑的一部分,系统生成如下动态程序集。
CompilerParameters cp = new CompilerParameters();
cp.GenerateExecutable = false;
cp.GenerateInMemory = true;
cp.TreatWarningsAsErrors = false;
cp.ReferencedAssemblies.Add("Employee.dll");
cp.ReferencedAssemblies.Add("Person.dll");
CompilerResults cr = provider.CompileAssemblyFromSource(cp, "someCode");
if (cr.Errors.Count > 0)
{..}
我在 NUnit-Gui-0.6.0 中打开单元测试程序集并测试一个方法,该方法最终将上述代码作为业务逻辑的一部分调用。
问题:Above Error Count 大于 0 并有以下消息:
error CS0006: Metadata file 'Person.dll' could not be found
error CS0006: Metadata file 'Employee.dll' could not be found
我已验证这些程序集与单元测试 DLL 一起存在于 bin 目录中。此代码适用于常规应用程序工作流程,但不适用于 NUnit 3.*。
环境详情:VS 2017. Unit Test DLL and Application DLLs are full .NET Framework 4.7.1.
不确定这是 NUnit 3.* 中的错误还是应用程序问题。
问候,
伊夫蒂哈尔。
【问题讨论】: