2

我有一个用 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   

如何打开这个网站进行编辑?

4

2 回答 2

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 属性。添加它并将其指向正确的代码隐藏文件。

应该是这样的。希望这可以帮助某人。

于 2014-07-01T09:31:10.437 回答
1

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

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

于 2012-10-23T14:57:50.767 回答