您正在尝试打开预编译的Web站点

时间:2012-10-23 14:54:20

标签: asp.net visual-studio-2010

我有一个在asp.net开发的网站。文件同时具有aspx页面和代码隐藏文件。当我尝试在Visual Studio 2010中打开它时,我收到此消息:

---------------------------
Microsoft Visual Studio
---------------------------
You are attempting to open a precompiled Web site. You can view the site, but changes might cause the Web site to stop functioning. To modify a site, it is recommended that you edit the files in the original Web site, precompile the site, and then publish it again.

Do you wish to continue and open this Web site?
---------------------------
Yes   No   

如何打开此网站进行编辑?

2 个答案:

答案 0 :(得分:3)

我知道这是迟到的,但它可能对后来的读者有用。

首先,Martuza Kabul错了。您只需要2个文件,.aspx / .ascx / .master和相关的.cs(这意味着.aspx.cs / .ascx.cs / .master.cs)

这里最有可能发生的事情是有人编译了网站,而DLL现在位于bin文件夹中。 (如果你和我一样幸运,他们也会在源代码控制中......)

这是您需要做的事情:

  • 删除PrecompiledApp.config文件
  • 删除bin文件夹中的所有非库.dll文件(我的是WebApp_122141Xas或类似的东西,这些是已编译的代码隐藏文件。)
  • 查看.aspx / .ascx页面的第一行 - 在该控制标记中 - 有一个"继承"属性...你会看到它有2个值,删除第二个。
  • 在同一个控件标记中,请注意缺少Codefile属性。添加它并将其指向正确的代码隐藏文件。

那应该是它。希望这有助于某人。

答案 1 :(得分:1)

您必须拥有CS文件才能编辑网站。我假设您正在尝试使用预编译选项打开之前发布的网站。

请在您的网站上发布文件类型以获取更多信息。