Automatically include all .cpp/.h files of a folder in a vcproj Project in Visual Studio - visual-studio

Is there a way to set a vcproj Project folder in order to automatically include all .cpp or .h files depending on the path of the project ?
On other words, when adding files to the folder of my project using Windows explorer, is it possible to have these new files automatically added to a vcproj Project, inside Visual Studio ? (even if I have to relaunch Visual Studio).
I do not need just to see them, but I need them to be automatically included inside the project for compiling and other operations...
The only way I see is to create a Visual Studio addin or a VB Script to do that...
Thanks,
Regards

You can edit project file and use wildcards. http://msdn.microsoft.com/en-us/library/ms171454%28v=VS.90%29.aspx

Related

Visual Studio EnvDTE - Open project folder in file explorer

When you right click a project in visual studio, there is an option "Open folder in File Explorer". How can the same be done from the automation model (EnvDTE) of visual studio? I thought I could use Project.FullName but that didn't work for our auto generated project files that have the .vcxproj file in a different folder than the actual .cpp files.
You can use
Project.Properties.Item("FullPath").Value
to get the correct path.

Excluding files in Visual Studio project

I've search everywhere for this, but have yet to find the answer.
I have a VS2012 project with thousands of files and folders I wish to exclude from the project as I don't need them to build any longer. Clicking on the folder and choosing Exclude From Project works, but takes literally forever - at times it appears Visual Studio has stopped running and I have to kill the process.
Question: What is Visual Studio actually doing to exclude a file from a project? Is there a way to simply go into the project file and exclude the files by folder? My project file does not appear to store this information. Where are excluded files defined for the project?
You can open the project file (in s text editor, i.e. Notepad) and remove the lines with the files that you want to exclude.
You can also do that in visual studio but you first need to unload the project (right-click on the project, unload)
Delete the folder in VS which has project to unload then restore it from recycle bin.
It works for me.

How can I set two Visual Studio projects to be in the same folder?

I wrote a C# windows service project and a related setup project in the same solution named MailTrigger. But after I built the whole program, there is two folders, "MailTrigger" and "MailTriggerSetup"(as I named the setup project). My problem is how can I set the two project to be in the same folder?
When you have a solution, you will have individual project directories under your solution directory. You have the ability with the setup project to tell it where to put the created binaries. I am not sure what specifically you are wanting, all of the files in one folder without any delineation between your main project and your setup?(which will not work) or just wanting your msi files in the same folder as your main projects code?
Edit: I was able to get a directory structure that looks like:
By moving the MailTriggerSetup Directory into the MailTrigger Directory and editing the MailTrigger.sln file's project settings with notepad to look like this, also just change the file paths not the Guid's :
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MailTrigger", "MailTrigger\MailTrigger.csproj", "{FD22977F-584D-4707-9B10-35482B91C450}"
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "MailTriggerSetup", "MailTrigger\MailTriggerSetup\MailTriggerSetup.vdproj", "{15C4C96E-EF6A-44DB- BDFB-8AEE2C05289E}"
EndProject
Some caution needs to be taken since you are directly editing the solution file, Please backup your data before trying this.

Visual Studio - How to change a project's folder name and solution name without breaking the solution

I am creating a project based off an old project because it has a lot of the functionality that I am required to use.
I want to rename all the directories and solution names to have the name of the new project. Under Documents\Visual Studio 2008\Projects I was able to change the initial directory and solution file names, but not the name of the subdirectory which houses the bin, obj, and properties folders. When I change the name of that subdirectory, none of the files will open when I open up the solution.
How can I change the project's folder name inside Visual Studio 2008 so that it will load all the files as part of the solution and still work?
You could open the SLN file in any text editor (Notepad, etc.) and simply change the project path there.
This is what I did:
Change project and solution name in Visual Studio
Close the project and open the folder containing the project (The Visual studio solution name is already changed).
Change the old project folder names to the new project name
Open the .sln file and the change the project folder names manually from old to new folder names.
Save the .sln file in the text editor
Open the project again with Visual Studio and the solution is ready to modify
I found that these instructions were not enough. I also had to search through the code files for models, controllers, and views as well as the AppStart files to change the namespace.
Since I was copying my project not just renaming it, I also had to go into the applicationhost.config for IIS express and recreate the bindings using different port numbers and change the physical directory as well.
go to my start-documents-iisExpress-config and then right click on applicationhost and select open with visual studio 2013 for web
you will get into applicationhost.config window in the visual studio
and now in the region chsnge the physical path to the path where your project is placed

Create visual studio solution template - multiple projects

I'm stuck on this tutorial for creating a multi-project visual studio template. I'm specifically stuck on this line:
Select the files and folders to include in your template, right-click the selection, click Send To, and then click Compressed (zipped) Folder. The files and folders are compressed into a .zip file.
I did the following steps:
Create 2 projects. (MyProj.Web and MyProj.Service)
Reference MyProj.Service in MyProj.Web.
Export both. They are now in a .zip file.
What do I do from here?
My intentions are: Make solution folders where some dlls will be (DI, unit testing frameworks, etc). Have these dlls referenced. Reference projects in other projects. Rename part of the projects. For eg. the ability to replace {MyProj}.Service with NewName.Service
The other parts includes making the .vstemplate xml file and placing the zip in the ProjectTemplates.
Per the article:
Put the .zip template file in the Visual Studio project template
directory. By default, this directory is \My Documents\Visual Studio
2010\Templates\ProjectTemplates\
The Visual Studio template will then be available from File > New Project. If making a template for a single item, place it in the \ItemTemplates folder instead to make it available from the Add New Item context menu in Solution Explorer.

Resources