Reputation: 2329
The problem I have at work is that I have to re-add references every time I get a new project from SVN. I'm trying to understand the process that the team need to follow to stop this happening.
The goal is so that anybody in the team can get the latest code and have a successful build. However, we always seem to have issues with references missing.
As a general rule we have a "libs" folder within the project and reference anything we need from inside that. I'm not sure if this is the best approach?
I've just done a test by getting the latest version of a site from SVN. This particular site looks like it must have been set up as a website rather than a web project as there is no vbproj file. I had a few references missing. I went into the property pages of the site to check the locations of the references. I thought the paths may be specific to somebody's machines but the references didn't even seem to be added. So I added the references that I needed (They were in the "libs" folder). Then everything built successfully but I had nothing marked to check in so what file actually changed when I added the references?
I think the problem may be a combination of web project verses websites and how visual studio treats them differently and how we are using the "libs" folder. Thoughts?
Upvotes: 0
Views: 1884
Reputation: 19340
You have two points here
where to keep references in multi-project solution
One way that will never fail you is to have a bin
folder (aka libs
- I really don't know why would people call it anything other than bin
) ... so... to have a bin folder in the same location as solution, while projects would be in their separate sub folders.
--Solution Folder
-- .sln
-- bin
-- Project1 Folder
-- Project2 Folder
Now, in your bin you keep all .dll
files, including ones you build and third party as well. Your projects will be referencing from this bin
and build output will go into this bin. This bin should be part of version control. It is not recommended to check-in your DLLs into this bin but do check-in third party DLLs. Also notice, referencing from "under solution" will create reference with relative path - this is important.
how to deal with references in Web Site Project (vs Web Site Application)
This is not unusual that out of the version control you don't have references in your website. Here is what you need to do. For each DLL that Web Site Project references, you need to create DllName.dll.Refresh
file under WebsiteProject-Bin
in which you will set relative path to that dll. .refresh
files should be checked-in. Once you build your libraries, only then you can build your website. It will pull all the DLLs you need to run it. With this setup, you now only need to make a virtual directory and point it to your WebsiteProject folder - you should have a running website.
Third point
Nuget
If your project(s) use nuget
packages, create packages
folder under your Solution folder and point there all nuget.config
in your projects. This way you will have one central nuget
repository, which will make your life easy.
If you follow these guidelines, you shouldn't have any problems building and deploying after Get Latest
from version control. Just make sure that all existing references are relative.
Upvotes: 1