VS2010 MV3 - How can I share files between solutions? - visual-studio

I am the only developer for an application. All the files for this application are stored on the same computer and I am using Visual Studio 2010 Ultimate.
The application has three solutions and these share common items such as some stylesheets, some javascript and shared views.
It's starting to become difficult when I change one file as I have to copy this to the other projects in the other solutions.
Is there a simple way that I could share files. Something that would help me be more productive. Possibly even some single user source code or a way of linking files between solutions.
Hope I can find someone to help me make my life easier.
Robert W

Even if you work on your own I would suggest some kind of Source Control System. Team Server is now free with Visual Studio or you can use open source tools. Like this you can link to source files in other projects and you can reuse your files.

Use Source Control! SVN is free so is TFS with Ultimate.
If its web based files (javscript, pictures, css, etc) use a virtual directory to point to the common code directories.
if its compiled code (C#,VB, etc) you can link the files. When adding an existing file in the dialog it will have a open button, with an arrow down. click the arrow down and "add as link" will be available. It will then use relative referencing to the other file. I use this technique for a SolutionAssemblyInfo.cs file.
I would recommend placing the common files in the same directory as the solution file or no more than 1 folder deep.

Related

Organizing project files in Visual Studio for better explorer view

I have a project in visual studio where there are several files arranged in folders (filters). Inside the project, everything is well organized, but as soon as I go to the explorer, I see that all the project files are in the same folder. How can I properly organize my project so that the repository doesn't look like a bunch of files in one folder?
I use Visual Studio 2022
I tried to manually decompose the files into folders, but when I did this, visual studio began to swear that it could not find the files
Can you share a screenshot of what you have and what you want?
I ask because there are two aspects to this.
The arrangement of projects within Solution Explorer
The arrangement of files within projects within Solution Explorer
The first can be controlled by adding solution folders. The structure is stored within the .sln file.
The second is generally a representation of the file system, depending upon your project type.
Also, make sure you're using the Solution Explorer view. Does this button appear clicked for you?
If so, you should unclick it. Solution Explorer can show you either the solution view (default, and what I refer to above) or the file system view.

How do I add existing library files into TFS?

I am new to TFS and I'm trying to add some custom library files that the whole team uses into Team explorer in Visual Studio. It's library files of Sahi Testing tool so that any changes made to the files can be seen on all machines. I have tried searching online but could not find exactly what I want. Help
Basically, you have the following options:
If you have Nuget Packages for the libraries, you do not necessarily have to add the packages to source control and restore them when you need them. See this link for details.
As an alternative, you can add libraries as binary files to source control so that each developer or build server can retrieve them together with the source code. It's a good practice, to add them to a special location so that they are located in one place and not spread over the solution. However, only use this approach for binaries that do not change too often. Otherwise, you might bloat your TFS database if the files are large and change very often.

Create Visual Studio Project using files on Server

How do I create a Visual Studio Project for Development on my Local PC that links to Existing files and folders on a Server?
My employer has a large website. Most of that girth (close to 100 GB) is contributed to Portable and Image document (i.e. PDF and JPEG) files, but there are also numerous web files (.html, .aspx, .php, etc).
We have the following folders:
a WORKING folder that contains everything that is "Live" on our web server.
a BETA folder that contains newest technologies that are being tested and tried.
a DEVELOPMENT folder that contains numerous copies of projects that are being worked on by the different developers.
Developers are allowed to use whatever tools they prefer, so we have people who develop using Notepad++, Dreamweaver, Komodo, Zend Studio, and (now) Visual Studio.
It is NOT OK for me to create Visual Studio Projects for myself on the network servers. Other developers using other tools are not creating solution files or \bin and \obj folders on the servers, and I certainly should not be either.
So, to work on a file in Visual Studio, I use Windows Explorer to browse to the location, then I open it in the IDE.
However, this causes me to lose a lot of the power of Visual Studio - particularly if other classes used in this file, because I would have no access to the Intellisense for that class and I cannot simply Right-Click and go to definition.
Also, since each development environment is so large, I can not copy them to my laptop with its high tech 125 GB Solid State Drive (should be interesting to read that in a couple of years).
What I would like to do is create the Visual Studio Projects on my local drive, and then have them reference the files and folders on our network.
I've looked and found these similar questions, but my goal is slightly different:
Working efficiently on remote projects in Visual Studio
How do I add an existing directory tree to a project in Visual Studio?
How to "Add Existing Item" an entire directory structure in Visual Studio?
These are all great topics, but none of them show a way to create a local project that uses remote files.
It would seem that developers in large company teams would have already developed a way to do this, and that I just do not know what it is called.
I have found a way to do this!
For a long time, I was working with 2 sets of folders. One for our repository and one for Visual Studio.
I'd make changes in Visual Studio, then copy those working files over to the repository folder.
That was time consuming! Very.
Here is how I found to fix it: Open the Visual Studio Project file (*.csproj, *.vbproj, or *.phpproj) in NOTEPAD with Visual Studio closed.
Locate the <ItemGroup> tab, and change every path to be from the one shown to one that uses a relative path to get to the actual files.
Notepad's Replace... CTRL+H will save you hours here!
It makes a funky looking project environment, but it works!
If this helps anyone else or if it were even something you didn't know you could do to manipulate Visual Studio, kindly vote it up.

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 relative reference path

I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here
I set in my project the reference path for all the needed folder, but if a developper checkout the trunk, he have to set all the reference path. Is there a way to simplify this ?
And am I using Visual Studio 2008.
Thank you.
I'm not sure which Visual Studio language you use, but if it's C++, then then file paths are stored in the .vcproj project file which should also be under version control. (NOTE: the .sln solution file does NOT store path settings) If you are careful to use relative, rather than absolute paths, it should be easily sharable among multiple developers.
In Visual C++ 2008, project files are XML so you can edit them directly. If you want to get really fancy, you can use .vsprops property sheets for additional control.
I use a shared folder on the network for stuff like that. And give that folder full trust. on the PDC i just have a login script that maps approriately. Its might not be the best way, but its worked for me without any issues.
Another solution I have used in the past is a common folder on each machine where all dependancies go, and have it syncronize with some sort of tool. I use Backup Exec which comes with Desktop and Laptop option which has a syncing feature, but other things work as well.

Resources