I have an existing directory structure that is all nicely checked into SVN, so I don't really want to mess with it.
The website code lives in a folder called C:\Projects\TheProject\Website. I want to bring the website files into a new Web Application Project without changing the directory structure.
Ideally the resulting file structure would look like this:
- C:\Projects\TheProject\TheProject.sln
- C:\Projects\TheProjects\Website\Website.csproj
No matter what I try I dont get what I want. There is no option to create a web application from existing code. This is very frustrating. Does anyone know if it is possible?
Create a new web project with a .csproj file. Delete all the files it comes with. Drag everything into the project.
OK I figured it out. It's weird, but the following steps will work:
- Open fresh copy of Visual Studio
- File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
- Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Have you tried something like this?
- Create a new Visual Studio Blank Solution from File-->New Project-->Other Project Types-->Blank Solution, making sure to specify c:\Projects\TheProject as your solution directory.
- Copy the folder with all of the existing website stuff into c:\Projects\TheProject\WebSite.
- Back in Visual Studio, right-click your solution in Solution Explorer and select "Add Existing Website." Then, pick your c:\Projects\TheProject\WebSite folder.
Good luck, HTH.
On top of @cbp answer I would like to add that if you would like to keep the Version control history of those files - in step 6 - instead of copy do:
git mv original-website/* new-web-application-directory/.
What have you tried? I normally create a blank solution and add existing folders (drag and drop on solution explorer works best), and have not had a problem.
In the File menu, click Open, and then click Web Site. Choose the root folder where your Web Site is located
in VS 2008 File->New->Project From Existing Code