An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module
来源:互联网 发布:房卡麻将源码教程 编辑:程序博客网 时间:2024/05/01 23:39
今天编写一个c++ clr程序调用c# dll,由于不熟,爆出一个错误
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module
c# 类库代码:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CSharpDll0217{public class Class1{private string name;public string Name{get{return name;}set{name = "Your Name: " + value;}}}}
c++ clr 控制台程序代码:
// Clr0217.cpp : main project file.#include "stdafx.h"#using "D:\\hbj\\test\\test1024\\Debug\\CSharpDll0217.dll"using namespace CSharpDll0217;using namespace System;int main(array<System::String ^> ^args){ Console::WriteLine(L"Hello World");Class1 ^c1 = gcnew Class1;c1->Name = "zzj";Console::WriteLine(c1->Name); return 0;}
然后就报错了:An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module
搜索了一下,stackoverflow上说工作路径保持一致,于是修改c# dll项目输出路径:Properties->Build->Outpath,使其与c++生产的exe同一目录
然后c++代码路径也顺便修改:
#using "D:\\hbj\\test\\test1024\\Debug\\CSharpDll0217.dll"
至此问题解决。
参考:http://stackoverflow.com/questions/9729691/an-unhandled-exception-of-type-system-io-filenotfoundexception-occurred-in-unk
http://developer.51cto.com/art/201104/254308.htm
http://blog.csdn.net/benbencoco/article/details/20464533?utm_source=tuicool&utm_medium=referral
0 0
- An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module
- n unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.Additional information: 未能加载文件或程序集“..
- An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
- C#--An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll in c#
- An unhandled exception of type "System.InvalidCastException" occurred
- vs 程序运行时跳出 An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in 。。 错误
- An unhandled exception of type 'System.StackOverflowException'
- An unhandled win32 exception occurred in explored.exe[1108]
- Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Enterp
- Event Code: 3005 An unhandled exception has occurred.
- An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more informat
- unhandled exception filenotfoundexception 文件输出
- Exception in thread "main" java.io.FileNotFoundException
- unhandled exception type UnsupportedEncodingException
- Unhandled exception type ParseException
- Unhandled Exception: System.BadImageFormatException
- 405错误(An unhandled exception occurred while processing the request)
- A first chance exception of type 'System.NullReferenceException' occurred发生的时候你确实是遇到了Bug
- ReactNative中文网推出的代码热更新服务
- java 企业网站源码 后台 springmvc SSM 前台 静态化 代码生成器
- 注释 Android Framework 中的一堆 debug 信息
- Qt 渐变色Gradient
- 【整理】Adam Taylor玩转Microzed系列——以太网通信部分
- An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module
- 微信自适应页面
- rsync远程同步+inotify-tools自动检测笔记
- php上传文件并存储到mysql数据库的方法
- Vue监听数据变化
- 终端环境运维菜单-yaml
- 最简单的鼠标悬停,实现下拉列表功能 bootstrap
- HDU1698 Just a Hook
- 云端卫士实战录 | OFTest 的安装和使用