程序报 System.TypeInitializationException 错误

xinrui1981 2007-03-14 04:50:35
我这个是自己写的windows程序,但是架构是照着PetShop4抄的,一直报错,哪位兄弟帮忙看看啊


////////////////////////////DAL层//////////////////////////////
namespace MS.DAL
{
public class ManuScript : MS.IDAL.IManuScript
{


#region IManuScript 成员

public void ListManuScript(DataSet dst)
{
string strSql = "select * from ManuScript order by id desc";

MS.DBUtility.Visit.RunDataSet(strSql, "ListManuScript", dst);
}

#endregion

}
}

////////////////////////////DataAccess层//////////////////////////////
public class DataAccess
{
/// <summary>
/// 设置用什么数据访问层,这里用Access的数据访问层
/// </summary>
private static readonly string path = "MS.DAL";

/// <summary>
/// 创建文稿的实例
/// </summary>
/// <returns></returns>
public static MS.IDAL.IManuScript CreateManuScript()
{
string className = path + ".ManuScript";
return (MS.IDAL.IManuScript)Assembly.Load(path).CreateInstance(className);
}

有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.TypeInitializationException: “MS.BLL.ManuScript”的类型初始值设定项引发异常。 ---> System.IO.FileNotFoundException: 未能加载文件或程序集“MS.DAL”或它的某一个依赖项。系统找不到指定的文件。
文件名:“MS.DAL”
在 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
在 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
在 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
在 System.Reflection.Assembly.Load(String assemblyString)
在 MS.DALFactory.DataAccess.CreateManuScript() 位置 D:\Article\Article\DALFactory\DataAccess.cs:行号 22
在 MS.BLL.ManuScript..cctor() 位置 D:\Article\Article\BLL\ManuScript.cs:行号 11

警告: 程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。
注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

--- 内部异常堆栈跟踪的结尾 ---
在 MS.BLL.ManuScript..ctor()
在 ManuScript.MainForm.MainForm_Load(Object sender, EventArgs e) 位置 D:\Article\Article\ManuScript\MainForm.cs:行号 29
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** 已加载的程序集 **************
mscorlib
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
ManuScript
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///D:/Article/Article/ManuScript/bin/Debug/ManuScript.exe
----------------------------------------
DevExpress.Utils.v7.1
程序集版本: 7.1.1.0
Win32 版本: 7.1.1.0
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/DevExpress.Utils.v7.1/7.1.1.0__79868b8147b5eae4/DevExpress.Utils.v7.1.dll
----------------------------------------
System.Windows.Forms
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
DevExpress.Data.v7.1
程序集版本: 7.1.1.0
Win32 版本: 7.1.1.0
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/DevExpress.Data.v7.1/7.1.1.0__79868b8147b5eae4/DevExpress.Data.v7.1.dll
----------------------------------------
System.Configuration
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
DevExpress.XtraGrid.v7.1
程序集版本: 7.1.1.0
Win32 版本: 7.1.1.0
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/DevExpress.XtraGrid.v7.1/7.1.1.0__79868b8147b5eae4/DevExpress.XtraGrid.v7.1.dll
----------------------------------------
DevExpress.XtraEditors.v7.1
程序集版本: 7.1.1.0
Win32 版本: 7.1.1.0
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/DevExpress.XtraEditors.v7.1/7.1.1.0__79868b8147b5eae4/DevExpress.XtraEditors.v7.1.dll
----------------------------------------
mscorlib.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
System.Data
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
BLL
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///D:/Article/Article/ManuScript/bin/Debug/BLL.DLL
----------------------------------------
DALFactory
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///D:/Article/Article/ManuScript/bin/Debug/DALFactory.DLL
----------------------------------------
IDAL
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///D:/Article/Article/ManuScript/bin/Debug/IDAL.DLL
----------------------------------------
System.Windows.Forms.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。

例如:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

启用 JIT 调试后,任何无法处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。


...全文
785 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yg123aa 2007-03-14
  • 打赏
  • 举报
回复
可以我的文件文件路径是对的啊
而且我引用进去了也有问题
sunrobust 2007-03-14
  • 打赏
  • 举报
回复
System.IO.FileNotFoundException: 未能加载文件或程序集“MS.DAL”或它的某一个依赖项。系统找不到指定的文件。

说得很清楚了,文件未找到

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧