Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly cache problem in Visual Studio

I have a problem with assembly caching in visual studio. I want to alter the references I have with strongly names assemblies. So I signed the assemblies and they were signed successfully, but when I try to reference them in visual studio it seems that it still caches the old version! I can not find a way to delete the old ones, I even changed the version and VS is still unable to detect the new ones.

any ideas?

Thanks

like image 360
John Avatar asked Mar 07 '11 19:03

John


2 Answers

I think this is the same problem I was having. My solution is the following, which seems to work reliably (for me anyway, in Visual Studio 2015):

  1. From the File menu, select Close Solution.
  2. From the File menu, click Recent Projects and Solutions and reopen your solution.
  3. Right click on a project in the Solution Explorer and select Unload Project. (I use a project at the tail end of my reference dependencies, something that doesn't depend on other projects, but on which most other projects depend.)
  4. Right click on the unloaded project and select Reload Project.

Et voila! your assembly references for all your projects should now point to the right assembly files. At least they should if your problem was similar to mine.

In my case, assemblies were referenced via a $(PathToAssembly) MSBuild property, set in an MSBuild targets file included from my project file. When the value of the PathToAssembly property changed, the references were not updating, due to some internal cache in Visual Studio. The above incantation correctly updates the references.

like image 183
yoyo Avatar answered Oct 10 '22 19:10

yoyo


Check the properties of an added reference.

enter image description here

The Path property allows to find out where the old assembly is located and delete it. Please also pay attention to Copy Local property value. If it is false then the old assembly is resided at GAC and you should uninstall it from there.

like image 40
ogggre Avatar answered Oct 10 '22 21:10

ogggre