[已解决]无法加载“_Default”类型。在VS.NET中编译网站时 [英] [Solved] Could not load type '_Default.' in VS.NET when compiling website

查看:96
本文介绍了[已解决]无法加载“_Default”类型。在VS.NET中编译网站时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑,我不知道自己做错了什么。


$ VSB在VS2010中,我创建了一个带有ProjectDAL类库的项目,另一个名为ProjectCommonObjecs的类库和另一个名为ProjectBLL的类库,并用代码填充它们,并且它们都编译完成。接下来,我将一个ASP.NET空网站添加到名为ProjectWebSite的解决方案中。



然后我使用复制网站将一些旧网站复制到新网站中。 。在上下文菜单上。在其\Bin文件夹中有一个OldWebSite.DLL文件和OldWebSite.PDB文件。事实上,我想将OldWebSite的Default.asp页面加入Project后面的Default.aspx.cs代码。



事情是,复制后,我必须将OldWebSite.DLL文件放在我的新网站项目的\ Bin子文件夹中,否则当我进行构建时,它会说



无法在Visual Studio环境中的错误列表窗口中加载类型'_Default。'



。当我在\ Bin文件夹中有OldWebSite.DLL文件时,所有内容编译都很好,但后来忽略了我的新代码隐藏;如果.DLL文件丢失,那就有错误。



我到处搜索但是无法弄清楚哪里可能仍然有参考.DLL; web.config中没有任何内容,Default.aspx标记页面中没有任何内容。标记页面引用了CodeBehind OK,据我所知,但我可能做错了。



这是页面代码顶部的一个片段:



I am so confused, and I don't know what I could be doing wrong.

in VS2010, I create a project with a ProjectDAL class library, another class library called ProjectCommonObjecs and another class library called ProjectBLL and fill them all with code and it all compiles. Next, I add an ASP.NET Empty Web Site to the solution, called ProjectWebSite.

Then I copy some old website into the new one using Copy Web Site... on the context menu. In its \Bin folder there was a OldWebSite.DLL file and OldWebSite.PDB file. Thing is, I wanted to join the OldWebSite's Default.asp page to the Project's Default.aspx.cs code behind.

Thing is, after the copy, i have to have the OldWebSite.DLL file in the \Bin subfolder of my new Web Site project, otherwise when I do a build, then it says

Could not load type '_Default.'

in the Error List window inside the Visual Studio environment. When I have the OldWebSite.DLL file in the \Bin folder, everything compiles fine, but then my new code-behind is ignored; if the .DLL file is missing, then there is an error.

I've searched everywhere but can't figure out where there might still be a reference to the .DLL; there's nothing in the web.config and nothing in the Default.aspx markup page. The markup page references the CodeBehind OK as far as I can tell but I may be doing something wrong.

Here's a snippet from the top of the page code:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class="no-js">

<head id="Head1" runat="server">





如果有人知道这个菜鸟做错了什么,请随时分享!谢谢。



Brian



If anyone has an insight for me as to what this noob is doing wrong, please feel free to share! Thanks.

Brian

推荐答案

有效的解决方案来自orc_orc_orc:更改'Codebehind'属性'CodeFile'
The solution that worked was from orc_orc_orc: Change the 'Codebehind' attribute to 'CodeFile'


这篇关于[已解决]无法加载“_Default”类型。在VS.NET中编译网站时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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