简体   繁体   中英

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.

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. 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? 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. 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. 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 .

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. Thanks to you anyway, YonahW. :-)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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