简体   繁体   English

在ASP.NET网站中正确使用文件设计器文件

[英]Properly using file Designer Files in ASP.NET Web Sites

I need to get existing web pages into an existing ASP.NET web site project in Visual Studio 2008. I simply tried to drag and drop the whole file folder content into the Visual Studio Solution Explorer or even to copy them into the web site folder. 我需要将现有网页放入Visual Studio 2008中现有的ASP.NET网站项目中。我只是试图将整个文件夹内容拖放到Visual Studio解决方案资源管理器中,甚至将它们复制到网站文件夹中。

Both ways, Visual Studio seems unable to map the .designer.cs files to the corresponding .aspx (or .master) file, even after restarting the whole IDE. 两种方法,即使重新启动整个IDE,Visual Studio似乎也无法将.designer.cs文件映射到相应的.aspx(或.master)文件。 The Solution Explorer entry looks in a way like this: 解决方案资源管理器条目的外观如下所示:

- Main.aspx
    Main.aspx.cs
  Main.aspx.designer.cs

Can I make Visual Studio file the designer-file below the aspx-file in any way? 我可以通过任何方式使Visual Studio文件成为aspx文件下的设计器文件吗? I strongly hope there is a simpler way than manually creating each file and copying and pasting the contents into each file by hand. 我强烈希望有一种比手动创建每个文件并将内容手动复制并粘贴到每个文件中更简单的方法。

It sounds like you are trying to bring web application files into a web site. 听起来您正在尝试将Web应用程序文件带入网站。 IIf that is the case , The designer files are not even needed. 就是这种情况 ,甚至不需要设计器文件。 Just dont include them. 只是不包括他们。 They are generated and compiled in at runtime when the website runs. 它们在网站运行时在运行时生成和编译。

Kind of partially self-answering my question: 有点自我回答我的问题:

In a web project - in contrast to a web site - it works perfectly through drag and drop onto the solution explorer, as I did for the web site before. Web项目中(与网站相反),通过拖放到解决方案资源管理器中可以完美地工作,就像我之前在网站上所做的那样。 To make the decision which type of "web site unit" to use there is another thread here on stackoverflow: ASP.NET Web Site or Web Project . 为了决定使用哪种类型的“网站单元”,在stackoverflow上还有另一个线程: ASP.NET网站或Web项目

In a web site I can't even use YonahW's solution, because I can't just put files into the proper web site directory without causing them to be added to the web site automatically. 在一个网站中,我什至不能使用YonahW的解决方案,因为我不能仅仅将文件放入适当的网站目录中,而不会导致文件自动添加到该网站中。 Thanks to you anyway, YonahW. 无论如何,感谢您,YonahW。 :-) :-)

尝试通过文件系统复制文件,然后右键单击该项目并选择添加一个现有项,此时您可以一次选择所有项,这通常会将它们放在适当的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM