Click here to Skip to main content
12,830,888 members (42,278 online)
Click here to Skip to main content
Add your own
alternative version

Stats

8.7K views
3 bookmarked
Posted 27 Sep 2014

ASP.NET Website Project – External Assembly References

, 27 Sep 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mohit1110
Architect Infinite Computer Solutions
India India
Dear Technologists,

This is Mohit Jain, working in Bangalore as Technical Architect. I love to work in Microsoft Technologies. I am having rich 16+ years of experience. Started career with VB, ASP then moved to .Net. I have worked with fortune 500 reputed clients like Microsoft, American Express, Iron Mountain and Xerox etc and helped them in Design, Solution, Execution and Implementation of enterprise applications.

I own MCTS in Web and Windows Development, MCPD in Web, Windows and Enterprise Development, MCSD in Web and Windows Development. I have extensive knowledge on ASP.Net, C#, VB.Net, ASP, JavaScript, Web Services, WCF Services and SQL Server.

If you have any challenges in .Net code, feel free to contact me at mail_mohitjain@yahoo.co.in, I will try my best to help you out.

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170326.1 | Last Updated 27 Sep 2014
Article Copyright 2014 by Mohit1110
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid