Project Locations in Visual Studio 2015 - visual-studio

I have an ASP.NET Core app that will be using some class library projects e.g. domain, repositories, etc.
These class libraries will also be used in another cloud app that runs as a worker role which is why I want to keep them separate and their development should follow its own course and not necessarily depend on the ASP.NET Core app.
With that said, the ASP.NET Core project should be aware of any changes made to the class library projects which is why I want to link them to the solution for the ASP.NET project.
What's the best way to structure these project folders? Currently my folder structure is as follows:
My Projects Folder
--- MyAspNetCoreProject (Has its own solution)
--- MyBackendProject (Has its own solution which contains the following projects)
----- DomainProject
----- RepositoriesProject
When I try to "Add Existing Project" to link my backend projects to my ASP.NET Core project, I get the following message:
The project that you are attempting to add to source control may cause
other source control users to have difficulty opening this solution or
getting newer versions of it. To avoid this problem, add the project
from a location below the binding root of the other source controlled
projects in the solution.

You'll need to move the referenced project under the same solution. If you do want separate solutions you can't link as a project -- before .NET Core you could link the assembly(s) instead.
One problem of trying to link projects under other solutions is that other users may not have a copy of all the necessary solutions and may be installed in different locations from other users. The solution needs to keep track of where the assemblies are built.
If you build the library as a NuGet package then linking the reference is easy.
Your options become
Move all projects under the same solution
Keep separate solutions and publish your library as a (private) NuGet package

Related

Building a project changes another project's bin folder in a Visual Studio Solution

I've dozens of web applications and lots of class libraries in a solution. When I build a web application, let's say "A", another web application project, let's say "B", affected by this compiling. The "A" and "B" are not referenced directly, but they uses same class libraries. If I build or rebuild "A", the created assemblies by this build goes to the "B"'s bin folder, too. So, everytime I build "A", I'm waiting the startup of the "B". As far as I know, there isn't any hardlink/symlink between these bin folders of the projects.
Also, I'm using common output path for class libraries, but not for web applications.
Is this a bug or default behavior? How can I prevent this behavior?
Is this a bug or default behavior? How can I prevent this behavior?
This is default behavior. Add a Project Reference to a Visual Studio Web Project, the following are added to your Web project's Bin folder:
A copy of the assembly created from the added project.
Copies of dependent assemblies, XML document files, license files, resource files, and so on.
So once you add the library project to web, the assembly from the added project will automatically add to the web project`s Bin folder.
If you want to prevent this behavior, you can pack the class libraries as a NuGet package, then add that package to the web project A and B. You can refer to this document for more info about NuGet create package.

template project in TFS

I have a "common" web template project in tfs. This web project is mainly for common layout and library framework that will be used for many other projects.
Every time I work on a new project, I always create a branch from the "common" template. With such structure, if there's new changes on the common framework, I can always merge the new changes to the "common" template.
The problem I face now is when I have multiple projects open and I try to run the project, it always run the project I first opened in VS. It think this could be due to the assemblyinfo.cs in the project. I tried to change the solution name and the project name but couldn't resolve the issue.
My VS version is 2012 Professional
I still couldn't find a suitable answer for this. What I had to do to get around is to set the virtual port on the web project.

Sharing my dll libraries across projects in VS2010

What is the best way to share dll libraries between projects, through VS2010? For example we have made a generic helper library that is useful in everything. However, we need more than one library to be included (which is a separate project in TFS) so branching is not suitable.
We are using Team Foundation Server 2010 for source control. Is there maybe a simple way to integrate these libraries into a new project, so the new project can come "fully buffed" very fast?
What we do now is go through each project, build them, store the dll files, add a new project then throw them in the Bin folder, which is tedious work when you have many libraries.
Have you thought about hosting your own NuGet feed? I use a pre-build script for NuGet for each of my projects which downloads packages for me before the project is built, and, I assume, keeps them up to date.
I don't think that there is some TFS-based solution for sharing binaries between projects. However you can use NuGet to do it for you. Create nuget package for each project (you can create TFS build definition to do it automatically) and publish it to network share. Than add this share as NuGet feed.

specify dll locations in VS

I have about 15 projects in a solution, and all of them have some broken third-party dll references. How do I configure VS to look for dlls in one specific directory? I am trying to compile and link my project, but it doesn't work because projects have broken references to existing third-party dlls. My solution consists of C# class library projects and an ASP.NET web site.
If they are project references (and they probably should be), you should not need to (unles you have moved the projects)
Otherwise, create a third-party Lib folder (under source control) at the solution root folder, place your third-party DLLs in it and reference from there.
If you need to fix up references, download and install VSCommands 2010 which has a very useful copy and paste references feature (among others). [Fix up for one project, and then simply copy and paste to other projects. Failing that, you would need to manually edit the .proj files, using Powershell for instance.]
You go from one project to the other and update the references to point to the new location.
If this is a third party DLL, you can record a macro the first time you do this and replay it for each project.

Team Foundation (TFS 2010) Folder Cloaking - Server Side Alternative?

I have a website project that is consuming user controls from another shared project. I am using a build event to copy the *.ascx files over from the source user control project.
I don't want the ascx files to be checked into TFS source control from the consuming project, only the source project. Is there a way to keep TFS from trying to check in files from a specific folder other then cloaking?
My issue with cloaking is that it's a client side function, which means every developer who takes down the project would have to manually cloak the folder or folders in question themselves. I'd like to be able to setup the solution in such a way as a developer could take the project down from source control without having to manually configure it to accommodate my separate project for shared user controls.
There is an article here: http://devio.wordpress.com/2009/11/05/shared-aspx-and-ascx-files-in-visual-studio-and-tfs/ that seems to address this issue but I think they're setup is different then mine in that I am using a website project and not a web application project. Being that I have no .csproj file there's no way to include or exclude files from my project.
Check out the TFS Power Tools (if you haven't already) http://visualstudiogallery.msdn.microsoft.com/en-us/c255a1e4-04ba-4f68-8f4e-cd473d6b971f, under Team Members > General Settings, you can setup a Worspace Template to cloak as needed.
Not played with it myself, but looks to be the functionality that you need.

Resources