How do I automatically include folders and files to the deployment project in visual studio? - c++

I have a c++ project in visual studio and a folder called assets, in the same location as the source file, that contains folders for music, sound effects and images that my c++ game uses. That folder must be placed in the same folder as the .exe file of the game.
I have created a deployment project for the c++ project. However, it seems like I need to manually add these folders (assets, images, music, etc.) and files to the File System on Target Machine.
Is there a way for visual studio to add these folders and files automatically?
I have not managed to find anyting online for how to do that so far.
Thanks.

This link provides many methods. You could drag all the files you want to add into the file system view. Or you could right click on the folder in explorer and click copy and then right click the folder in the file system view in the setup project and click paste.

Related

Keeping source folder structure in windows runtime application assets

I am trying to create a Windows runtime application (in c++) and I want to store some "external" files in the application's Assets. I figured out there is a 'Content' flag which makes the file included in the package. However, if files are not located in the solution folder, all the files from all subfolders go directly into the Assets folder, which creates a huge mess. I want to keep my source folder structure. This works if the assets are located in the solution folder, but this is inconvenient for me.
On Android, you simply specify any assets folder location, and this folder is packaged as is. Can I do something like this on windows?
This post sort of gives answer to this question: Assets folder for Windows 8 Phone app.
However it feels like almost nobody including me have that drop-down option on the Add button (I am using VS2013 Ultimate Update 4).
So is there another solution? Can I for instance edit the visual studio project by hands?
Add as Link is only available for C# and VB Projects.

Build a visual studio project on a subset of files in a directory

I would like to port my application from Linux to Windows. I'm trying to use visual studio to configure a project to build the Window application. The problem for me is that I only need a subset of files out my directory for Windows. But I would like to keep the integrity of the directory so that I don't need to checkout a subset of file to Windows. Does visual studio need the entire directory to be window files? For those who understand Window application development well, can you help me to understand:
Can I configure visual studio to build a project using a subset of the file from a directory?
If yes, how do I configure the project file? Any link to a tutorial would be really helpful.
Below are couple of quick suggestions using Visual Studio
Include/ Exclude :
If the number of file are minimum, then you could include or exclude files to a project manually.
You could add a directory to a project by copying the files to a folder under the .vcxproj(ur .<>proj) file.
Then select the project in the solution explorer and on the tool bar you would get an option Show All Files
Right click on the Folder or File and hit Include In Project. This will include the file/folder into your project.
You could Exclude any file that is already included in your project by, clicking the file and hit Exclude From Project.
Remove From Compilation Only:
Select the file in Solution Explorer and right click Properties
Under Configuration Properties -> General -> Excluded From Build set it to Yes/No

How to add class to openframeworks project in VS2012

I am normally a C# guy but trying to get into c++.
I made myself a new openframeworks project by copying and pasting one of the example projects and then renaming everything to my project name. (If there is an easier way, I would love to hear it)
This project has the .cpp and .h files in a sub folder called "src" which are in turn organized into virtual folders (filters???) in visual studio.
How can I add a class to this project from within visual studio?
If I right click on the src filter in the solution explorer and hit add class. It creates the class files at the root of the project not in the src folder. I mean it does this both in the solution explorer and where it physically places the files. This is a problem because I can't include my class files in the rest of my app, presumably because they aren't in the same folder
What is the proper way to add a class file?
When you right click on the filter (could be the "src" or a new one) and hit 'Add class', after hitting 'Add' in the first screen, in the next one you will find a [...] button besides each text input field for the .h .cpp files: with that button you can chose the folder where your files are going to be saved ('src' or any other).
It isn't a good solution but the only way I have found to do this is to add the class in visual studio, which places it in the root. Exclude the files from the project. Move the files to the src folder using Windows Explorer. Include them in the project by showing all files and then right clicking to include in project. At this point I would expect the files to be listed in the project but don't appear until I reload the project. Once the project is reloaded I then drag and drop the files into the src folder/filter

Add folders in a visual c++ project

How can I add whole folder and its subdirectories in a visual c++ project? I am using visual studio 2010 professional. I mean you can add files by using Add Existing Item but how do you add a whole directory?
The quickest way that I know of is to
add the folder to your project file directory using Windows Explorer
find the folder in Solution Explorer (make sure Show All Files is checked)
right click on the folder and select Include In Project
You may have to do the folder and the files separately, but you can select multiple files at once.

Creating a good directory structure

This might be a silly question but I am still learning. I have read several books on creating application and creating a good directory structure. When people talk about creating a directory structure, do they mean the folders you make within the solution explorer (folders you actually find inside of a .sln file) or do they mean setting up and creating folders that reside in the same folder as your .sln file or your compiled application (.exe). I figured the solution explorer folders are different from a typical windows folder cause the folders I create inside my .sln file are no where to be found on my windows system.
Visual Studio has a strange way of dealing with "folders" in solutions. A "Solution Folder" is not actually a physical folder, but more of a virtual folder managed by Visual Studio. Your files may end up in the root directoy, but VS will treat them as if they are in a "folder." This is configured and managed in the VS .sln or project file.
I'm not a fan of how this works in Visual Studio, I don't get why they don't just put files in physical folders. It's up to you whether you want to fight VS and try to keep your files in physical folders, or if you want to just let VS manage it, but ultimately, it really doesn't matter.
a typical directory struction will be like
bin (binaries)
Src
->.sln
->common
->.prj
->Project1
->.prj
->Project2
->.prj
Lib (3rd party lib's)
Doc (documentation)
Tools (3rd party tools)
Setup (setup projects)
Test (test cases)
With C++ in Visual Studio your solution directories need not match the filesystem, but they can.
Typically people refer to the directory structure as the filesystem layout of the project.
It's typical to have visual studio directories called headers and source, you wouldn't lay your project out like this on your filesystem though.
Visual Studio directories aren't just virtual folders though, they can contain filter rules so when you add a file to your project it will automatically get added to the correct filtered folder. They can also specify whether the folder should be under version control or not. And whether they should be parsed for auto complete or not.
Typically on filesystem I will create 1 folder per project and rarely create subfolders inside an individual project. But in the solution explorer I will create top level folders which I put projects into (For example: "Server Components" and "Client Components"), as well as in project folders to group things logically together (For example: Config, GUI, Controllers, ...) so I can find what i'm looking for faster.