views:

448

answers:

3

I need to get existing web pages into an existing ASP.NET web site 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? Building the website becomes a problem too that way, but that's the next problem I'm going to work on. :-)

I strongly hope there is a simpler way than manualle creating each file and copying and pasting the contents into each file by hand.

Thank you for any idea!

Cheers Matthias

A: 

try copying the files through the filesystem and then right clicking on the project and selecting to add an existing item at which point you can choose all at once and this usually puts them in the proper places.

YonahW
+1  A: 

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. :-)

Mudu
+3  A: 

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.

mattlant
Thank you! Sometimes solutions are that simple and comprehensible, but you just need to know...
Mudu