Software:
Visual Studio 2019
Steps for creating a new Visual Studio project based on existing code files:
- Create an empty project folder and name it your intended project name.
- Inside the new project folder, create a folder for your source code files.
* I call is “Source”, not sure if it has to named that way.. - Copy your existing code files to the source folder.
- Launch Visual Studio, and open it without code:
- Select:
File > New > Project From Existing Code..
To open the Create New Project From Existing Code Files wizard: - Note:
The documentation on this operation states that the wizard will copy files by itself, my own experience is that it doesn’t, it just links them to the project, that’s why I copy the source files prior to this step.
In the Create New Project From Existing Code Files wizard,
1. Set the path to your project folder.
2. Specify a project name.
* I set this to be the same name as the project folder name, not sure if otherwise it will create a sub-folder..
3. This is set to the same folder as the project folder.
* It’s possible that I don’t understand this correctly.. but I think theoretically, the intention is that you would add external folders to this list, from which source files would be copied, but like I said, when I tried that the files where not copied to the project. - Set your new projects settings and press Finish to create the new project:
Note:
New code files generated in a ported code project may be stored in a wrong folder by default, see this post for solutions.
One thought on “Creating a Visual Studio project from existing code”