在我的应用程序中,我试图从它的字节数组中运行一个exe,我这样做:
private static void RunFromBytes(byte[] bin)
{
Assembly a = Assembly.Load(bin);
// search for the Entry Point
MethodInfo method = a.EntryPoint;
if (method != null)
{
// create an is
我正在开发一个使用反射来加载插件的.NET应用程序。我的插件是C#类库。问题是我的一些插件引用了传统的Win32 DLL,C#盲目地试图加载依赖项,就好像它们是.NET DLL一样。
下面是我如何加载一个插件:
string fileName = "plugin.dll";
Assembly.LoadFrom(fileName);
我得到一个包含以下消息的System.BadImageFormatException:
Could not load file or assembly 'plugin.dll' or one of its dependencies.
我将代码分解为尽可能小的语句:
Dim cn As System.Data.SQLite.SQLiteConnection
在从WinForm应用程序调用代码时,我得到以下错误:
System.BadImageFormatException:无法加载文件或程序集“System.Data.SQLite、Version=1.0.65.0、Culture=neutral、PublicKeyToken=db937bc2d44ff139”或其依赖项之一。试图加载格式不正确的程序。文件名:'System.Data.SQLite,Version=1.0.65.0,Culture=neutral,P
我已经构建了outlook外接程序,使用Visual 2015专业加载项。并使用Click一次性部署推送到ftp位置,以便在任何版本更改发生时自动更新。从过去的3年开始,它一直运转良好。
现在,我正在使用VisualStudio2015社区加载项来进行一些更改,当我试图推送更改时,我得到的错误是
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
我正在使用SQLlIte互操作服务和
我目前正在增加软件产品的代码覆盖率,并遇到了一个问题;我所有的单元测试(使用‘任意CPU’编译时)都由于抛出'BadImageFormatException‘而失败。
这个异常可以通过使用'x86‘而不是’任意CPU‘构建解决方案来规避,但是需求是这样的,我们需要能够使用任何CPU/x64位来运行它们。
所有涉及Moq的单元测试都遵循几乎相同的格式:
[TestMethod]
public void GetProduct_ValidId_ProductReturned()
{
//Setting up the object
Product prod = new
我在VS2005中编写了一个dll,它将由VS2003中开发的另一个程序加载。当该程序试图加载我的dll时,它抛出一个System.BadImageFormatException: The format of the file 'Foo.dll' is invalid。
我搜索了SO和谷歌,似乎不同版本的.NET才是罪魁祸首。我的问题是:我如何解决这个问题?
(我不能修改VS2003中开发的程序。)