Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: Create a web application from existing code

Tags:

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?

like image 564
cbp Avatar asked Aug 25 '09 01:08

cbp


People also ask

How do I create a Visual Studio project from an existing code?

On the File menu, select New > Project From Existing Code. Specify your project location, the directory for your source files, and the kinds of files the wizard imports into the new project.

How do I open an existing Web project in Visual Studio?

Go to File > Open > Web Site. Select your website path and click Open. It will open website under new solution.


1 Answers

OK I figured it out. It's weird, but the following steps will work:

  1. Open fresh copy of Visual Studio
  2. File->New Project, select Web Application
  3. 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"

  4. Delete the auto-created Default, Global and Web.config files

  5. Save All and close Visual Studio
  6. In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.

  7. Double click on the sln file to open Visual Studio again.

  8. Select "Show all files" (at the top of Solution Explorer)

  9. Right click on any files or folders you want to add and select Include in Project.

like image 158
cbp Avatar answered Oct 04 '22 00:10

cbp