ASP.Net Website Project – External Assembly References

Today I just thought of removing the Assembly Reference errors which I get whenever I take the latest of an ASP.Net Website Project (Not ASP.Net Web Application Project) along with many class library projects.

 As we all know that Website project does not have any project file which can keep reference path and refer back dependencies from that path, the question arises where exactly these external assembly references are stored?
Analysis

The first thought came to my mind was, If project does not have any project file then it would be having same information somewhere in Solution file.  After going through the complete Solution file carefully, I learned that Solution File has references but all Internal for which the Projects are already added in same solution.

During 2 Hours of Goggling I found many links which had discussed about the same and provided many solutions.
One of the link from “StackOverFlow.com” specified that Visual Studio creates a Solution file in Projects folder of respective version of Visual Studio. If someone is using Visual Studio 2010 then a solution will be created at “C:\Users\username\Documents\Visual Studio 2010\Projects\YourWebSite\YourWebSite.sln which will have the path to the external assemblies.
 
I got what I was looking for and followed the specified path and later realized that  In this case I already had a solution created to manage all of my projects and except that solution I could not find any solution created anywhere.
 
Another thread suggested that an xml file is created at “%LOCALAPPDATA%\Microsoft\WebsiteCache\Websites.xml ” and the same is updated every time whenever an external link is added or removed. When I explored this location, found the same xml but unfortunately it did not have any reference’s to any external assembly.
 
During the search I was Adding and Removing the references in the Website project continuously and in the same process accidently noticed that whenever I add the external assembly reference, an additional file is also being added along with the assembly and this file had an extension “.refresh” and the full name was like “.refresh” e.g.  Telerik.Web.UI.dll.refresh . As always at first I thought of leaving this file and move ahead with my research but then decided to read about the same and was quite surprised with what I found about it. 
 
However I had seen this file quite many times earlier too during checking in the code to Source Control but never cared and left it unnoticed every time and today luckily opened this file in notepad. “.Refresh” file is the file which contains the full relative physical path of external referenced assembly. When you open this file, it looks like ..\..\..\3rdPartyDLLs\Telerik.Web.UI.dll .
 
As a Best Practice we do not add bin folder and any file added to it, in Source Control but in case of Website project, in order to allow the Solution to resolve the external references automatically during build of the project itself, it is required that .refresh files are checked in source control so that whenever anybody takes the latest for first time these assembly are placed in bin folder automatically.
 
Once I found all this, luckily I got an article over the web too explaining .refresh files and its usage.http://monsur.xanga.com/2006/02/03/dll-refresh-and-asp-net/
 
In case you find this article interesting, please do not forget to share the same with your peers and friends. You can use the email link below or any social media of your choice. Also rate the article, if it has really helped you learning something new.
 
I will be back soon with something new and interesting too.

Till then… Happy Learning..

Leave a comment