Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

ASP.NET Website Project – External Assembly References

0.00/5 (No votes)
27 Sep 2014 1  
In this blog, we would learn how an ASP.NET Website project keeps the references maintained as Website project does not have any Project file to maintain the same.

Introduction

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, 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 that came to my mind was, if project does not have any project file, then it would be having the 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 the same solution.

During 2 hours of Googling, I found many links which discussed about the same and provided many solutions.

One of the links from “StackOverFlow.com” specified that Visual Studio creates a Solution file in the 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, I found the same XML, but unfortunately it did not have any references 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 “<Assembly Name>.refresh” e.g. Telerik.Web.UI.dll.refresh. As always, at first I thought of leaving this file and moving 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 a few 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 the first time, these assemblies 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 in learning something new.

I will be back soon with something new and interesting too.

Till then… Happy coding...

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here