Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

project - Visual Studio: Create a web application from existing code

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:ProjectsTheProjectWebsite. 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:ProjectsTheProjectTheProject.sln
  • C:ProjectsTheProjectsWebsiteWebsite.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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...