- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的“WPF App (.NET)”项目中引用了一个“CLR 类库(.NET Core)”项目,但我遇到了一个异常:
BadImageFormatException: Could not load file or assembly 'LibCLR, Version=1.0.7646.21580, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format.
先说说我是怎么做到的。
在“LibCLR”项目中自动创建“LibCLR.h”,代码在里面
#pragma once
using namespace System;
namespace LibCLR {
public ref class Class1
{
// TODO: Add your methods for this class here.
};
}
using System.Windows;
namespace TestCLR {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
new LibCLR.Class1();
}
}
}
如果我在步骤 1 中为“TestCLR”选择“WPF App (.NET Framework)”,在步骤 2 中为“LibCLR”选择“CLR Class Library(.NET Framework)”,效果会很好
为什么没有效果?我不能在“WPF App (.NET Core)”项目中使用“CLR Class Library(.NET)”项目作为项目引用吗?我该如何解决这个问题?
最佳答案
关于dll - C# CLR 异常 "BadImageFormatException: Could not load file or assembly",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64025144/
我有一个 Web 服务,每当我尝试从 Visual Studio 运行该服务时,它都会引发 BadImageFormatException。 This answer另一个问题建议对 DLL 运行 pe
我在 X64 上运行 这是我的代码: ColorFileMapping = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, 0x04, 0, _byte
在 Windows 8 64 位上编译或尝试运行我的应用程序时抛出“BadImageFormatException”。我在网上搜索了一下,很多人都有同样的错误信息。但是,没有一个解决方案可以解决我的问
尝试使用 C# 7 的局部函数,我最终得到了一些有趣的行为。考虑以下程序: public void Main() { Console.WriteLine("Entered Main");
这个问题在这里已经有了答案: Could not load file or assembly ... An attempt was made to load a program with an in
我有一个使用 Visual Studio 2010 并以完整的 .NET Framework 4 为目标用 C# 编写的 Windows 服务。当我从调试版本运行时,该服务按预期运行。但是,当我从发布
我正在为另一个基于公共(public) .NET API 的程序编写插件。通常,这些插件是通过创建引用 API 程序集的类库 DLL 来制作的。然后通过从 API 程序集中的基本命令类继承来创建命令类
在通过联系本地 Web 服务的 .NET 3.5 SP1 项目进行调试时,我收到了异常 System.BadImageFormatException:“错误的类标记” 当然,关于导致异常的原因没有更多
我正在开发我的第一个自定义操作,但无法加载生成的 .CA.dll 文件。这是最简单的过程和结果: 我创建了一个自定义操作项目并保留所有默认值。该类看起来像这样: using Microsoft.Dep
我正在尝试运行我在 Visual Studio 2012 中创建的 WCF 服务。 我在页面中遇到以下错误。 > Exception Details: System.BadImageFormatExc
后续行动: OpenGL4Net WM_PAINT does not exist? 我仍然密切关注:https://sourceforge.net/p/ogl4net/wiki/Tutorials 目
我正在尝试运行我在 Visual Studio 2012 中创建的 WCF 服务。 我在页面中遇到以下错误。 > Exception Details: System.BadImageFormatExc
我已经从 Here 下载了 tesseract。当我尝试将 dll 文件添加到 visual studio 2012 时,它显示错误,表明它不是有效的程序集。任何人都可以建议我一些其他的 ocr 和示
请帮忙,我已经尝试了所有我能想到的方法来解决这个问题。 在您回复之前请注意: 我已尽我所能解决 StackOverflow.com 上的其他问题和网络上的其他软件。例如但不限于:将构建配置从“任何 C
我发誓 Microsoft 对 Visual Studio 的“进化”越多,整个过程就越无知。 我有一个包含 3 个类库的 Windows 服务。我进入每个类库的属性并将平台目标设置为 x64。我对
我遇到以下运行时错误,我的控制台应用程序 (VS2012) 引用“dcasdk.dll”。控制台应用程序的 .Net Framework 是 4.5,平台目标是“任何 CPU”。 Could not
当我尝试运行安装程序来设置服务时出现以下异常: # ./InstallUtil ../../../../Applications/GasPosApp/bin/Wrapper.exe -s ../../
当我尝试在 IIS 7.0(在 Windows Server 2008 上使用 VSTS 2010 + .Net 4.0 开发)中访问网站中的页面 (default.aspx) 时,我遇到了以下错误消
尝试从 .net 连接到 oracle 数据库时出现以下异常: Attempt to load Oracle client libraries threw BadImageFormatExceptio
问题 我正在构建服务结构应用程序。当我创建一个项目并运行它时,它工作正常。但是当我在 Api Controller 中注入(inject)服务时,它给了我这个错误,我尝试解决它但尚未成功。 错误 Sy
我是一名优秀的程序员,十分优秀!