How can I set two Visual Studio projects to be in the same folder? - visual-studio-2010

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.

Related

Folder structure for a Visual Studio 2017 with CMake

I am working in a new project in C++ with Qt that is using CMake to generate the solution.
The project is quite big and it's working fine both in Visual Studio 2017 and QtCreator. Most of the people generate the solution for building using Ninja and import the build to QtCreator. But I prefer working with VS IDE.
The problem is that with QtCreator the Solution Explorer is keeping the folder structure, but in VS, all the projects (libs and dlls) hungs up from the solution (root) so I lose some valuable information.
I am quite new in CMake, and I would like to know if there is a way to generate the VS solution with the same folder structure that the source code has without affecting QtCreator solutions.
CMake does support organizing the projects in your Visual Studio Solution Explorer into folders, so you can name the folders to mirror the directory structure on your system. For example, if your projects are organized like this:
Utilities/LibraryA
Utilities/LibraryB
Executables/tools/ParserExecutable
You can use the set_target_properties command with FOLDER to designate the containing folder for each project in the VS Solution Explorer:
Utilities/CMakeLists.txt:
set_target_properties(LibraryA PROPERTIES FOLDER "Utilities")
set_target_properties(LibraryB PROPERTIES FOLDER "Utilities")
Executables/tools/CMakeLists.txt:
set_target_properties(ParserExecutable PROPERTIES FOLDER "Executables/tools")
You can try to automate this by using CMAKE_CURRENT_SOURCE_DIR instead of naming the folder explicitly, but start with a simple case first!
Also, make sure you add this to your top-level CMake to enable VS folders for your projects.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

how to share a folder between two projects in Visual studio 2010

If I have a project called 'testing' in project A.
How can I share that folder 'testing' for project B in visual studio 2010?
The reason I would like to achieve about this is because when I change something in the folder testing of project A, I dont want to change the same things in project B.
Thanks in advance.
Maybe too late for the person who asked the question, but this is for people with similar problems. You can share folder contents with an extention 'Project Linker':
This builds upon the concept of linked files where you refer to the same file from two projects. This extention handles the management of that for an entire project. If you add a file to the project, it will be added too to the other project as a linked file. Same for deletes...
Attention: you need to have both projects in the same solution for this to work of coarse...
Extention VS2015
I used it in VS2010 and it's also availible for later versions.
You can't share folders in Visual Studio - they are logical constructs that are part of a solution or project.
The closest you can get is to add folders to the projects you need to share on and add all the files that you want to share as links. You will still need to manually synchronize all adds/deletes of files, but updates will come across all projects.
To make things easier, you may want to write a Visual Studio macro that synchronizes these folders for you (you can bind these to keyboard shortcuts and/or menu items).
If you put your solution (*.sln) files in the same directory they can share files in sub directories.

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

Automatically include all .cpp/.h files of a folder in a vcproj Project in 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

Visual Studio and TortoiseHg: folder not visible in VS

I created a C# project and added it to source control (mercurial). I can edit files in VS, commit it and push it using TortoiseHg. It goes to the server. When some one pulls they get the files.
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
However, now someone pulled the latest code from the server - and they got the new file (it is visible through windows explorer), but when they open the solution in VS, they don't see the file.
Does someone have an idea what is wrong here? or things I should check? Thank you for the help.
P.S. I have visual studio 2010 express (so I can't use the VisualHg plugin).
Visual Studio caches changes to the solution and project until an explicit save or a build. In your comment:
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
I see that an updated .sln or .vcproj file was not mentioned and checked in. Did you see an update to either of these files via TortoiseHg? If not, make sure to build or save your project after a change like this.
Did you make sure that the Visual Studio Project File or Solution file is being updated and committed?
VS solution contains projects and each project select managed files by metadata(***.vcproj file). It's not the way include all files from root directory.
So, your co-workers can see new added files by in following two ways.
1) share project file(***.vcproj)
2) manually add files in each person's VS instance.

Resources