{"id":123,"date":"2010-11-16T10:28:49","date_gmt":"2010-11-16T09:28:49","guid":{"rendered":"http:\/\/www.stuartroberts.net\/?p=123"},"modified":"2010-12-13T21:22:14","modified_gmt":"2010-12-13T21:22:14","slug":"debugging-sharepoint-timer-service-assemblies","status":"publish","type":"post","link":"http:\/\/www.stuartroberts.net\/index.php\/2010\/11\/16\/debugging-sharepoint-timer-service-assemblies\/","title":{"rendered":"Debugging SharePoint Timer Service Assemblies"},"content":{"rendered":"<p>If you&#8217;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&#8217;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.<\/p>\n<p>To force the service to refresh the assemblies it uses you need to restart the <em>SharePoint 2010 Timer<\/em> service from the services snap-in before attaching the debugger.<\/p>\n<p>Alternatively, you could add the following to the post-build event of the project you want to be able to debug:<\/p>\n<p>net stop SPTimerV4<br \/>\n&#8220;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\gacutil&#8221; \/i &#8220;$(TargetPath)&#8221; \/f<br \/>\nnet start SPTimerV4<\/p>\n<p>This will stop the SharePoint timer service, copy the updated assembly to the GAC before restarting the service again.<\/p>\n<p>Where&#8217;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:<\/p>\n<p>%windir%\\Microsoft.NET\\Framework\\v1.0.3705\\<br \/>\n%windir%\\Microsoft.NET\\Framework\\v1.1.4322\\<br \/>\n%programfiles%\\Microsoft Visual Studio .NET 2003\\SDK\\v1.1\\Bin\\<br \/>\n%programfiles%\\Microsoft SDKs\\Windows\\v6.0\\Bin\\<br \/>\n%programfiles%\\Microsoft SDKs\\Windows\\v6.0A\\Bin\\<br \/>\n%programfiles%\\Microsoft SDKs\\Windows\\v7.0\\Bin\\<br \/>\n%programfiles%\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\<\/p>\n<p>For reference, here is the Gacutil MSDN page: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ex0ss12c(VS.80).aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/ex0ss12c(VS.80).aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;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&#8217;t normally be enough for the correct symbols to be loaded. This is &hellip; <a href=\"http:\/\/www.stuartroberts.net\/index.php\/2010\/11\/16\/debugging-sharepoint-timer-service-assemblies\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[1,3],"tags":[7,81,5,6],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/plx2I-1Z","_links":{"self":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/123"}],"collection":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":5,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":174,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/123\/revisions\/174"}],"wp:attachment":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}