Add existing shared project, not added to source control - visual-studio

I have some shared projects which I use in a lot of other projects. My workflow for a new project is like this:
Create blank VS solution (check "Add to Source Control" in the New Project dialog)
Paste shared project folders into the solution folder
Add the shared projects to the solution by right-clicking the solution in VS, then selecting Add -> Existing Project and selecting the shproj-file of the pasted shared project
The shared project is now added to the VS solution, but it's not added to source control. Is there anything I can do to automatically add this project type to source control?
Adding an existing project of another type automatically adds it to source control. I expected it to behave the same for shared projects.

Related

Adding Existing folder(s) to a C++ Project in Visual Studio without creating a copy

I have a Visual Studio Solution containing multiple projects. (One Main Project and rest are used for testing the Main project)
Here, i have a shared folder within the solution which is used by all the projects within the solution.
I need to include the entire shared folder in my Main project instead of adding existed items.
I am using Visual Studio Professional 2015 and i could not find "Add Existing folder" option in Visual Studio.
Adding Existing items to a project will eliminate the folder structure in solution explorer which makes the usage more complex when included file count is huge.
I need to maintain a folder structure within the project.
Moving the shared folder within the project directory and using "Show All Files" option will avoid the issue(tried based on the answers in some links) but it is not accurate in my case as the folder is being used by different projects.
Do i have any way to add existing folder (Outside the Project within the solution) to a project and maintain a folder structure so that the solution explorer looks more readable?
I just found the solution to this issue.
We are suppose to create a Filter (Virtual Solution Folder) within the Project. Option for creating Filter is available on following below steps,
Select Visual Studio Project.
In Solution Explorer, Disable "Show All Files" option.
Note: When "Show All Files" option is enabled, your project will have an option to create a Folder instead of Filter.
Create a Filter/Virtual Solution folder. (Name could be same as the existing folder name outside the VS project in order to maintain readability)
Now, add required existing files to the Virtual Folder Solution from any location.
(Inside/Outside project location)
By following the above steps, one can add set of existing files to a virtual folder structure in Visual Studio Solution. This is equivalent to adding an Existing folder to a Project Solution without copying it.

Add existing files to visual studio project

I have a straightorward console application that I build using code::blocks. A client has requested a microsoft visual studio project to build it. So I downloaded and installed visual studio and created a project. Now I am trying to add my source files to the project.
Various online help pages say "Select project; select menu item "Add Existing Item" ( e.g. https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/9f4t9t92(v=vs.100). I cannot find "add existing item"! Add new item simply adds an empty file.
I tried dragging files from windows explorer onto the project, but this REMOVES the file from where it belongs - NOT what I want to happen.
Surely there must be a way to do this! Even without using alternative IDEs, different projects frequently must share common source code, so source files from one project need to be added to another.
The answer is to use File | New | Project from Existing code rather than simple 'New Project' when creating the project

VS2017: How to create Project From Existing Code in an existing solution

I want to add a bunch of existing projects to the solution in Visual Studio 2017. Those projects aren't originally intended to work in VS, so I am using File --> New --> 'Project From Existing Code' to make them usable there.
VS creates a new solution for every project during the creation of "Project From Existing Code". Can I change it so it will add such project to the existing solution at the time of creation?
The process I am using to add created from existing code projects to the solution:
I initially work with VS solution (which can contain projects).
I create a new project from my existing code (File --> New -->
Project From Existing Code).
VS builds up its specific project files as well as solution file in the new project folder, closes currently opened solution and opens newly created one.
I repeat for every project I want to include in one solution.
I reopen the solution I was originally working on in VS and I add the projects to the existing solution (native VS projects I just created).
I go to the each project's folder in File Explorer and delete solution in each of them to reduce the clutter.
The simplest would be:
Create a new solution.
Remove the project that was part of the template.
Import the existing projects one at a time (right click on the solution --> Add --> Existing Project)

Adding existing project as reference with packages, references fail

I have an existing project that uses several external packages that are included through the Visual Studio NuGet interface. Let's call this project Existing
In a separate project, I want to add that project as a reference. Let's call this project Separate.
I go to Separate and I right click on the Solution in Solution Explorer, and click "Add -> Existing project". This successfully adds Existing to Separate. I then right click on Existing and click build. This causes NuGet to get all of the packages.
However, after that happens all of the references are broken in Existing ... they all have the yellow triangle over them. If I look at the file system, they were successfully downloaded in to Separate\packages.
Why can't Visual Studio find the references? It installed them.

Why is TFS ignoring a project in my solution?

I have multiple projects in our solution that is in our TFS 2010 repository. I've added about 5 new projects to this solution in recent days.
I have found that for one of the projects, that the project file itself will not check-in to TFS. All of the artifacts contained in this project are working fine; they are checked in and I can see them in the Team Explorer. But I cannot see the project file in Team Explorer, nor is their an icon next to the project in Solution Explorer that would indicate its checked in status.
Also, clicking on any of the TFS related option in the context menu in Visual Studio results in those options being applied to the file contained in the project, not the actual project itself.
Can this be remedied or do I have to create an entirely new project and add all of the artifacts from the old project back into it?
Your project doesn't have appropriate Source Control Bindings! With the solution open, you'll need to go to File -> Source Control -> Change Source Control to view the bindings for your projects. The failing one probably will show an "Unknown" or not binded status. You can then use that dialog to correct the binding and check in the project file.
Appended Alternate Solution -
Navigate to the Team Explorer -> Source Control and manually add the files using the "Add Items to Folder" menu item.
You can try following steps
1 Unbind the project in "Change Source Control" dialog
2 Refresh project to update source control status
3 Right click the project and click Add the Project to source Control in solution explorer
I was faced with the same issue but the solution is slightly different than those mentioned so far. My project's contents were checked in but the project itself was not. The project's bindings were valid.
In the Team explorer's Source Code Explorer, the project files were greyed out. After a get-latest, TFS opened the Merge Conflicts screen where I could choose to keep the local copy.
After this, the project was part of TFS.

Resources