Search code examples
c++visual-studiovisual-studio-2017vcxproj

Simple and easy way to move visual studio vcxproj files from one folder to another


So I have a bunch of vcxproj files under the following folder

E:.
├───vddproject
│   └───scrproj
│       └───pjrdir
│           └───winsix
│               └───Arithmetic.vcxproj

There are bunch of vcxproj under winsix, I have taken one example here.

The files for Arthmetic.vcxproj are stored under

E:.
├───vddproject
│   └───scrproj
│       └───mediadir
│           └───Idexter
│               ├───create.cpp
│               ├───update.cpp
│               ├───read.cpp
│               ├───delete.cpp

The vcxpproj file is present under the solution file math.sln

E:.
├───vddproject
│   └───scrproj
│       └───mediadir
│           └───Idexter2
│               └───math.sln

the content of sln file being

Project("{506CAAF2-81A4-4731-B667-24899A39FC25}") = "Arithmetic", "..\..\pjrdir\winsix\Arithmetic.vcxproj", "{DCB15F39-4E20-439D-A949-368B48CF261E}"
EndProject

Now I need the smart and simple solution to move my vcxproj from its current folder to another folder Arithmetic with structure as

E:.
├───vddproject
│   └───scrproj
│       └───mediadir
│           └───Idexter
│               └───Arithmetic

How can I do this without me manually editing the vcproj, vcxproj.users, vcxproj.filters files


Solution

  • Here is what you need to do.

    1. Remove the project Arithmetic from the sln Math from the solution explorer.
    2. Move the following files from winsix to your folder Idexter->Arithmetic Note : You don't need to move Arithmetic.vcxproj.user files as these are automatically created.
    • Arithmetic.vcxproj
    • Arithmetic.vcxproj.filters
    • Move any rc2 or rc files. Check for Arithmetic*.rc and Arithmetic.rc2 files.
    1. Edit the Arithmetic.vcxproj file These are some basic tags for which you need to edit the corresponding path, there might be more, please confirm the same
    • ImportGroup
    • PropertyGroup IntDir and OutDir
    • AdditionalIncludeDirectories
    • AdditionalDependencies(check if you have any relative paths here)
    • AdditionalLibraryDirectories
    • AdditionalIncludeDirectories
    • ItemGroup : This contains the relative path to your actual source file
    1. Edit the Arithmetic.vcxproj.filters file

    Check for any relative path here that needs to be edited. Basic tags being ItemGroup.

    1. Now add the vcxproj file to the solution by right clicking on the solution name : Add existing project. Your solution file will also be updated in the process, no need to make any changes here