Visual Studio Caching

Since I’ve been developing with Visual Studio 2010 for SP I can’t help but feel I’ve wasted valuable time trying to resolve issues that the caching mechanism used by Visual Studio has caused.

For example, I deployed a feature that created a list on the activating web using the ListInstance element. Initially, I set the name and description with hard coded values and all was good in the world.

I then added a feature resource and added entries for the list instance’s name and description. Deleting the list and re-deploying the solution (via Visual Studio) gave the desired result. I then decided to change the display title of the list and updated the resource file accordingly.

I once again deleted the list and re-deployed the solution. The name of the list stayed as it was originally in the resource file and had not updated with my change. Slightly perplexed, I double checked the feature in the hive to make sure the resource had been correctly deployed, which of course, it had.

Changing the name back to a hard coded value would correctly deploy but no matter what modifications I made to the resource string the title always showed using the original value given to it. This is obviously due to caching I thought and decided to reset iis prior to deploying again. As you might guess, this gave me the same results as before, still the wrong list title.

Restarting Visual Studio and trying the deploy again, I was fairly confident that it would deploy, but once again I got the same old list title. I restarted Visual Studio as I had experienced issues previously with deploying site column definitions that it complained about already existing, when I was completely certain that the column had been removed. Doing this had resolved things then, but not this time.

Deploying using PowerShell worked like a charm, confirming to me that the culprit here was indeed Visual Studio related. As restarting Visual Studio had not resolved my issue, I investigated further and found that doing this had not restarted the vssphost4.exe process. This process is responsible for executing SharePoint commands and had cached my resource file content. Restarting this process and deploying my solution finally gave me the desired results.


This entry was posted in SharePoint and tagged . Bookmark the permalink.

10 Responses to Visual Studio Caching

  1. casper says:

    I am not familiar with English, and i hope you can understand what I ask.

    I face the same problem recently when I develop a workflow on sharepoint.
    I use visual studio to directly deploy, but I always get the wrong result – not the latest version I deployed.
    I have tried to shutdown vssphost4.exe and restart visual studio, but it does not work.
    Could you share more detail about how to solve this issue??

    • Stu says:

      Hi Casper,

      The workflow timer service (SharePoint 2010 Timer) has probably locked the assembly, so restarting it should allow it to execute\update using the latest version. To restart type the following two statements at the command prompt:

      net stop SPTimerV4

      It’s a good idea to perform an iisreset prior to restarting the timer service.

  2. casper says:

    Hi Stu,

    I have other problem which is not related to this post but I cannot find any resource to fix.

    I hope you can share some experience to me.

    I am working on a dynamic workflow – state machine. I generate a logToHistory event right after onTaskCreated but somehow the log message appear twice.

    I have no idea why the onTaskCreated will be triggered twice.

    Thanks a lot.

  3. I find that if I delete the *.aps file, then the cached resource information goes away. For example, if my project name is Viewer, then deleting file “Viewer.aps” cures the problem.

Leave a Reply to casper Cancel reply

Your email address will not be published. Required fields are marked *

Solve the maths problem shown below before posting: *