{"id":1373,"date":"2013-04-20T15:33:15","date_gmt":"2013-04-20T14:33:15","guid":{"rendered":"http:\/\/www.stuartroberts.net\/?p=1373"},"modified":"2013-04-20T15:38:20","modified_gmt":"2013-04-20T14:38:20","slug":"my-development-configuration","status":"publish","type":"post","link":"http:\/\/www.stuartroberts.net\/index.php\/2013\/04\/20\/my-development-configuration\/","title":{"rendered":"My Development Configuration"},"content":{"rendered":"<p>Just wanting to share the utilities, custom scripts and applications that I use when developing for SharePoint.<\/p>\n<p>Besides the obvious, Visual Studio, SharePoint Designer and InfoPath, the following is what I find makes developing and debugging that little bit easier.<\/p>\n<p><strong>Visual Studio<\/strong><\/p>\n<p>When using Visual Studio, I add a few custom menu items to the Tools menu, the following are my staples:<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Custom-Tools.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Custom-Tools.jpg\" alt=\"Custom Tools\" width=\"271\" height=\"459\" class=\"aligncenter size-full wp-image-1430\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Custom-Tools.jpg 271w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Custom-Tools-177x300.jpg 177w\" sizes=\"(max-width: 271px) 100vw, 271px\" \/><\/a><\/p>\n<p>First up, there&#8217;s a menu item for displaying the strong name key for the current assembly.:<br \/>\n<!--more--><br \/>\n<a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Get-SN-Key.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Get-SN-Key.jpg\" alt=\"Get SN Key\" width=\"396\" height=\"391\" class=\"aligncenter size-full wp-image-1431\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Get-SN-Key.jpg 396w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Get-SN-Key-300x296.jpg 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/a><\/p>\n<p>The command here references the <em>%programfiles(x86)%\\microsoft sdks\\windows\\v7.0a\\Bin\\sn.exe<\/em> file and the following argument <em>-T $(TargetPath)<\/em>.  The -T option is used to display the public key token for the assembly given by the TargetPath variable.<\/p>\n<p>Next, I add an option for listing all of the worker processes:<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/List-Worker-Processes.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/List-Worker-Processes.jpg\" alt=\"List Worker Processes\" width=\"395\" height=\"391\" class=\"aligncenter size-full wp-image-1432\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/List-Worker-Processes.jpg 395w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/List-Worker-Processes-300x296.jpg 300w\" sizes=\"(max-width: 395px) 100vw, 395px\" \/><\/a><\/p>\n<p>The command this time is <em>C:\\Windows\\System32\\inetsrv\\appcmd.exe<\/em> and the argument <em>list wp<\/em>.<\/p>\n<p>Running provides an output similar to:<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Worker-Processes.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Worker-Processes.jpg\" alt=\"Worker Processes\" width=\"561\" height=\"136\" class=\"aligncenter size-full wp-image-1433\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Worker-Processes.jpg 561w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/Worker-Processes-300x72.jpg 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/a><\/p>\n<p>Which makes it easy to identify which w3wp process to connect to when debugging.  Using add-ins such as <a href=\"http:\/\/cksdev.codeplex.com\/\" title=\"CKSDev\" target=\"_blank\">CKSDev<\/a> allow you to connect to the available IIS processes but not a specific one.<\/p>\n<p>The next three options (To GAC&#8230;) all use a custom batch file which looks like:<\/p>\n<pre lang=\"dos\">\r\n@Echo Off\r\nEcho.\r\nEcho Copying %1 to the GAC\r\n\r\nif \"%2\" == \"1\" (\r\n  Echo.\r\n  iisreset \/restart\r\n  net stop SPTimerV4\r\n  net start SPTimerV4\r\n)\r\nif \"%3\" == \"1\" (\r\n  Echo.\r\n  %windir%\\System32\\inetsrv\\appcmd recycle apppool \/apppool.name:\"SharePoint - 80\"\r\n)\r\n\r\nEcho.\r\n\"%Program Files(x86)%\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\gacutil\" \/i \"%1\" \/f\r\n<\/pre>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Reset.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Reset.jpg\" alt=\"To GAC with Reset\" width=\"396\" height=\"391\" class=\"aligncenter size-full wp-image-1435\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Reset.jpg 396w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Reset-300x296.jpg 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/a><\/p>\n<p>The argument for the <em>To GAC with Reset<\/em> option is <em>$(TargetPath) 1<\/em>.  This copies the current assembly to the GAC and performs an IIS reset.  Again, the CKSDev add-in provides this functionality but you need to copy it first and then reset IIS afterwards, this combines it into the one command.<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Recycle.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Recycle.jpg\" alt=\"To GAC with Recycle\" width=\"396\" height=\"391\" class=\"aligncenter size-full wp-image-1437\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Recycle.jpg 396w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-with-Recycle-300x296.jpg 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/a><\/p>\n<p>The argument for the <em>To GAC with Recycle<\/em> option is <em>$(TargetPath) 0 1<\/em>.  As with the previous command, this also copies the current assembly to the GAC but this time recycles the SharePoint 80 application pool.<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC.jpg\" alt=\"To GAC\" width=\"396\" height=\"391\" class=\"aligncenter size-full wp-image-1438\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC.jpg 396w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/To-GAC-300x296.jpg 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/a><\/p>\n<p>The argument for the <em>To GAC with Recycle<\/em> option is <em>$(TargetPath)<\/em>.  This command simply copies the current assembly to the GAC.<\/p>\n<p>The last custom option I use is <em>SP Dispose Check<\/em>.<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/SP-Dispose-Check.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/SP-Dispose-Check.jpg\" alt=\"SP Dispose Check\" width=\"396\" height=\"391\" class=\"aligncenter size-full wp-image-1439\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/SP-Dispose-Check.jpg 396w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2013\/04\/SP-Dispose-Check-300x296.jpg 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/a><\/p>\n<p>First, download the tool from the following site <a href=\"http:\/\/archive.msdn.microsoft.com\/SPDisposeCheck\" title=\"SharePoint Dispose Checker Tool\" target=\"_blank\">Dispose Check<\/a>.<\/p>\n<p>Then add the tool using the command <em>%ProgramFiles(x86)%\\Microsoft\\SharePoint Dispose Check\\SPDisposeCheck.exe<\/em>, argument <em>$(BinDir)<\/em> and initial directory <em>$(SolutionDir)<\/em><\/p>\n<p>OK, that&#8217;s it for the Visual Studio tools.  Next up, the custom scripts that I use.<\/p>\n<p><strong>Scripts<\/strong><\/p>\n<p>Only the one script, if you exclude the copy to GAC batch file.<\/p>\n<p>This script request the SharePoint timer job to process.  Easier than going into the Central Administration site and manually running the timer job.<\/p>\n<p>First there&#8217;s the PowerShell script:<\/p>\n<pre lang=\"powershell\">\r\nparam($url,$timerjobName)\r\n\r\n$snapinAdded = $false\r\n\r\ntry {\r\n\tif ( (Get-PSSnapin -Name Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue) -eq $null ) {\r\n\t\t$global:snapinAdded = $true\r\n\t\tWrite-Host \"Adding Sharepoint module to PowerShell\" -NoNewline\r\n\t\tAdd-PSSnapin Microsoft.Sharepoint.Powershell -ErrorAction Stop\r\n\t\tWrite-Host \" - Done.\"\r\n\t}\r\n\r\n\tWrite-Host \"Adding Microsoft.Sharepoint assembly\" -NoNewline\r\n\tAdd-Type -AssemblyName \"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\"\r\n\tWrite-Host \" - Done.\"\r\n\t\r\n\tWrite-Host \"\"\r\n\tWrite-Host \"Starting `\"$timerJobName`\" \" -NoNewline\r\n\t\r\n\t$webApp = $null\r\n\tif ($url -ne $null -and $url -ne \"\") {\r\n\t\tWrite-Host \"for $url \" -NoNewLine\r\n\t\t$webApp = Get-SPWebApplication $url\r\n\t}\r\n\t\r\n\t$job = Get-SPTimerJob | where{$_.Name -match $timerjobName} | where{($webApp -eq $null) -or ($webApp -ne $null -and $_.Parent -eq $webApp)}\r\n    if ($job -eq $null)  {\r\n        Write-Host '- Timer job was not found.' -ForegroundColor Red\r\n    }\r\n\telse {\r\n\t\t$job | Start-SPTimerJob\r\n\t\tWrite-Host \"- Done.\" -ForegroundColor Green\r\n\t}\r\n}\r\ncatch {\r\n\tWrite-Host \"\"\r\n    Write-Host \"Error starting timer job $timerJobName: \" $error[0] -ForegroundColor Red\r\n\tthrow\r\n\tExit 1\r\n}\r\nfinally {\r\n\tif ($global:snapinAdded -eq $true) {\r\n\t\tWrite-Host \"\"\r\n\t\tWrite-Host \"Removing Sharepoint module from PowerShell\" -NoNewline\r\n\t\tRemove-PSSnapin Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue\r\n\t\tWrite-Host \" - Done.\"\r\n\t\tWrite-Host \"\"\r\n\t}\r\n}\r\n<\/pre>\n<p>and the batch file to run the script:<\/p>\n<pre lang=\"dos\">\r\n@ECHO OFF\r\n\r\nSet Url=\r\nSet timerJob=job-workflow\r\n\r\npowershell.exe -Command \".\\StartTimerJob.ps1 -url \\\"%Url%\\\" -timerJobName \\\"%timerJob%\\\"  exit $LastExitCode\"\r\n\r\npause\r\n<\/pre>\n<p>Finally, I&#8217;ll list the applications and utilities that I use the most.<\/p>\n<p><strong>Apps and Utilities<\/strong><\/p>\n<p>In no particular order:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.red-gate.com\/products\/dotnet-development\/reflector\/\" title=\"Reflector\" target=\"_blank\">Reflector<\/a><\/li>\n<li><a href=\"http:\/\/www.jetbrains.com\/resharper\/\" title=\"ReSharper\" target=\"_blank\">ReSharper<\/a><\/li>\n<li><a href=\"http:\/\/u2u-caml-query-builder.software.informer.com\/\" title=\"U2U CAML Query Builder\" target=\"_blank\">U2U CAML Query Builder<\/a><\/li>\n<li><a href=\"http:\/\/sharepointsearchserv.codeplex.com\/\" title=\"SharePoint Search Service Tool\" target=\"_blank\">SharePoint Search Service Tool<\/a><\/li>\n<li><a href=\"http:\/\/powergui.org\/index.jspa\" title=\"Power GUI\" target=\"_blank\">Power GUI<\/a><\/li>\n<li><a href=\"http:\/\/notepad-plus-plus.org\/\" title=\"Notepad++\" target=\"_blank\">Notepad++<\/a><\/li>\n<li><a href=\"http:\/\/www.linqpad.net\/\" title=\"LINQPad\" target=\"_blank\">LINQPad<\/a><\/li>\n<li><a href=\"http:\/\/www.izarc.org\/\" title=\"IZArc\" target=\"_blank\">IZArc<\/a><\/li>\n<li><a href=\"http:\/\/archive.msdn.microsoft.com\/ULSViewer\" title=\"ULS Viewer\" target=\"_blank\">ULS Viewer<\/a><\/li>\n<li><a href=\"http:\/\/spm.codeplex.com\/releases\/view\/35932\" title=\"SharePoint Manager 2010\" target=\"_blank\">SharePoint Manager 2010<\/a> and <a href=\"http:\/\/spm.codeplex.com\/\" title=\"SharePoint Manager 2013\" target=\"_blank\">SharePoint Manager 2013<\/a><\/li>\n<li><a href=\"http:\/\/fiddler2.com\/\" title=\"Fiddler\" target=\"_blank\">Fiddler<\/a><\/li>\n<li><a href=\"http:\/\/www.wireshark.org\/\" title=\"Wireshark\" target=\"_blank\">Wireshark<\/a><\/li>\n<li><a href=\"http:\/\/www.microsoft.com\/en-gb\/download\/details.aspx?id=7973\" title=\"XML Notepad\" target=\"_blank\">XML Notepad<\/a><\/li>\n<li><a href=\"http:\/\/cksdev.codeplex.com\/\" title=\"CKSDev VS add-in\" target=\"_blank\">CKSDev Visual Studio add-in<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Just wanting to share the utilities, custom scripts and applications that I use when developing for SharePoint. Besides the obvious, Visual Studio, SharePoint Designer and InfoPath, the following is what I find makes developing and debugging that little bit easier. &hellip; <a href=\"http:\/\/www.stuartroberts.net\/index.php\/2013\/04\/20\/my-development-configuration\/\">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":true,"jetpack_social_options":[]},"categories":[1],"tags":[5],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/plx2I-m9","_links":{"self":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/1373"}],"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=1373"}],"version-history":[{"count":13,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/1373\/revisions"}],"predecessor-version":[{"id":1448,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/1373\/revisions\/1448"}],"wp:attachment":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/media?parent=1373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/categories?post=1373"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/tags?post=1373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}