大约 2 年前,我在 .NET 2.0 中编写了一个用于数据库访问的类库,并且一直在 .NET 2.0、3.0 和 3.5 上使用它。
在我正在处理的当前项目(这是一个 .NET 4.0 应用程序)中,尝试使用旧的忠实类库,但出现以下异常:
System.InvalidOperationException 未处理
Message=创建表单时出错。有关详细信息,请参阅 Exception.InnerException。
错误是:混合模式程序集是针对运行时版本“v2.0.50727”构建的
并且在没有额外配置信息的情况下无法在 4.0 运行时加载。
来源=学校经理
堆栈跟踪:
在 SchoolManager.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
在 SchoolManager.My.MyProject.MyForms.get_frmGeneric()
在 D:\Alex\Documents\Visual Studio 2008\Projects\School Manager\SchoolManager\My Project\Application.Designer.vb:line 35 中的 SchoolManager.My.MyApplication.OnCreateMainForm()
在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(字符串 [] 命令行)
在 SchoolManager.My.MyApplication.Main(String[] Args) 在 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数)
在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,布尔 ignoreSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态)
在 System.Threading.ThreadHelper.ThreadStart()
内部异常:System.IO.FileLoadException
Message=混合模式程序集是针对版本“v2.0.50727”构建的
运行时,并且无法在 4.0 运行时中加载而无需额外的
配置信息。
来源=Dinofage.Data.XpressData
堆栈跟踪:
在 Dinofage.Data.XpressData.ExecuteSelectInternal(字符串选择命令)
在 Dinofage.Data.XpressData.ExecuteSelect(字符串选择命令)
在 D:\Alex\Documents\Visual Studio 2008\Projects\School Manager\SchoolManager\Modules\Academics.vb 中的 SchoolManager.Academics.GetNewAdmissionCode(String AcademicYear):第 89 行
在 D:\Alex\Documents\Visual Studio 2008\Projects\School Manager\SchoolManager\UserControls\StudentDetail.vb:line 20 中的 SchoolManager.StudentDetail..ctor()
在 D:\Alex\Documents\Visual Studio 2008\Projects\School Manager\SchoolManager\frmGeneric.Designer.vb:line 25 中的 SchoolManager.frmGeneric.InitializeComponent()
在 SchoolManager.frmGeneric..ctor()
内部异常:
可能出了什么问题,我该如何解决?