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.
If you’re creating your own workflows and want to be able to debug into your code using the timer service (OWSTIMER.EXE) deploying your assembly to the GAC won’t normally be enough for the correct symbols to be loaded. This is due to the SharePoint timer service keeping a cached version of the assemblies it uses.
To force the service to refresh the assemblies it uses you need to restart the SharePoint 2010 Timer service from the services snap-in before attaching the debugger.
Alternatively, you could add the following to the post-build event of the project you want to be able to debug:
net stop SPTimerV4
“C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil” /i “$(TargetPath)” /f
net start SPTimerV4
This will stop the SharePoint timer service, copy the updated assembly to the GAC before restarting the service again.
Where’s the location of the gacutil program? Gacutil comes with version 1 and 1.1 of the .Net framework (not 2 or above) and Visual Studio. So it should be in at least one of these locations:
%programfiles%\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\
For reference, here is the Gacutil MSDN page: http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx
This post is more of a reminder for myself than anything else, as I always forget the exact settings required when I move to a new role.
The first setting is for listing the strong name key for the active Visual Studio project.