我通过在 st流上说的努尼特和视力演播室问题而感染,但在我的案件适合的情况下,却找不到任何透镜。
Im利用NUnit测试一些代码I,I m把我测试项目的文件装入Unit GUI工具。
I figured out the problem I guess but I got no solution so far. What I m doing:
I reference 2 other projects both are dll projects. This means I got 3 projects: TestProject (DLL), SettingsManager(DLL), DatabaseInterface (DLL). All are in one solution. The DatabaseInterface project contains native api calls to another, C++ x86, DLL, but does not explicit reference this DLL via "using" statement.
两者都属于一种情形,储存一些配置数据,如道路和营地;等等。 测试项目和数据库Interface参考资料《背景》。
所有3个项目都以“建议”和“AnyCPU”为基础。 Referencing & using only the SettingsManager in my Test Project workvy but when, 我请我加上数据库Interface,我看上去一个BadImageFormatception告诉我,它试图装上带有错误格式的档案。
为了使之更加明显,工作单位:
using myNamespace.Settings; // contains SettingsManager
using System;
using NUnit.Framework;
namespace myNamespace.myTestProject
{
[TestFixture]
public class TestProject
{
[SetUp]
public void SetUp()
{
}
[Test]
public void ReadDbFile()
{
string s = SettingsManager.DbFile; // gets the path of the db file
}
}
}
NUnit Output:
这一工作:
using myNamespace.Settings; // contains SettingsManager
using myNamespace.DbInterface; // contains DatabaseInterface, which contains native calls to C++ dll
using System;
using NUnit.Framework;
namespace myNamespace.myTestProject
{
[TestFixture]
public class TestProject
{
DatabaseInterface instance = null;
[SetUp]
public void SetUp()
{
}
[Test]
public void ReadDbFile()
{
string s = SettingsManager.DbFile; // gets the path of the db file
}
}
}
第二场审判,载有
using myNamespace.DbInterface;
throws a myNamespace.myTestProject.TestProject(TestFixtureSetUp): SetUp : System.BadImageFormatException : Die Datei oder Assembly "DatabaseInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" or a reference was not found. It was tried to load a file of a wrong format."
即使所有3个项目都使用
I m, using a standard *.config file, as the one of the NUnit Testproject. 也许有些人这样做是错误的。
Did anybody encountered the same error trying to load code from another DLL so far? Can it be a problem that both projects (Test & Database) reference the SettingsManager DLL ? Did I do something major wrong?
我在所有3个项目中两次核对了我的建筑组合,但未能找到任何可能错误的环境,并解释