System.TypeLoadException与解决方案中的多个项目 [英] System.TypeLoadException with multiple projects in solution

查看:85
本文介绍了System.TypeLoadException与解决方案中的多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个VS2008解决方案,其中包含3个项目(类库,Windows应用程序和Web应用程序).我正在使用在Windows应用程序和Web应用程序的类库中定义的对象.这对于Windows应用程序非常有用,但是当我在网页后面的代码中创建对象时,出现System.TypeLoadException:

I have created a VS2008 solution with 3 projects in it (Class Library, Windows Application, and Web Application). I am using objects that I define in the Class Library in both the Windows application and the web application. This works great for the Windows application, but when I go to create an object in the code behind of a web page, I get a System.TypeLoadException:

无法从程序集"Nutz,版本= 1.0.0.0,文化=中性,PublicKeyToken =空"中加载类型"Nutz.MusicMaster.Song".

Could not load type 'Nutz.MusicMaster.Song' from assembly 'Nutz, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

描述:在执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息:System.TypeLoadException:无法从程序集"Nutz,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null"中加载类型"Nutz.MusicMaster.Song".

Exception Details: System.TypeLoadException: Could not load type 'Nutz.MusicMaster.Song' from assembly 'Nutz, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

我将类库添加到了Windows应用程序和Web应用程序的引用中(右键单击引用"->添加引用"->项目").

I added the class library to the references in both the windows app and the web app (Right click on References -> Add Reference -> Projects).

任何引起原因的想法将不胜感激!谢谢!坚果

Any ideas on what is causing this would be greatly appreciated! Thanks! Nutzy

推荐答案

我能够通过创建一个新的解决方案并将所有现有的类,页面和控件添加到其中来解决此问题.

I was able to solve this problem by creating a new solution and adding all of my existing classes, pages, and controls to it.

这篇关于System.TypeLoadException与解决方案中的多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆