Deploy DLL and admin rights

Sometimes, when working with corporate machines, it can happen that you have security issues that make your SharePoint development harder.

One of these problems is that even if you are machine administrator, or you have started Visual Studio as administrator, you still have problems with deploies, or you have DLL locked in the GAC and you are not able to update/delete them.

The solution to this problem is to remove the admin approval from the local policies:

  • run the Local Security Policy MMC snap-in (from the start menu, run, type Local);
  • go to Security Settings | Local Policies | Security Options
  • disable "User Account Control: Run all administrators in Admin Approval"
  • reboot the machine

I've seen this trick in the blog post Access Denied trying to uninstall assemblies from GAC.

Using StyleCop to enforce source code standardization

StyleCop is a Visual Studio add-on used to enforce C# source code style rules.

After installation, you can run the checks from the new menu voice Tools | StyleCop; after execution, it will display its alterts as warnings in the Error window.

You can configure the type of warnings to be signaled with the online editor, that modifies the Settings.StyleCop file (simply double click on the file on your file system to edit it).

It's enough to have the Settings.StyleCop file (or better: a link, so that all projects reference a common file) in your Visual Studio project, so that after each build these additional checks are done. And StyleCop can work as a custom MSBuild task too.

You can find more informations in the blog post Enforcing coding standards with Microsoft StyleCop.

Visual Studio: Collapse All Solution Explorer

Sometimes you have to open very big solution files in Visual Studio; but when Visual Studio opens these big solutions, by default they are all expanded in the Solution Explorer window, so that you can see only a few projects, and you would like to collapse them all.

For this reason, I did some researches and found that Visual Studio hasn't a native command to do this, and so a dedicated macro is needed.

I found one in the post Collapse all Solution Explorer items in Visual Studio 2010: it is very good because the author comments how to install it also.

I've modified it, to ensure that the macro works after the project has been opened and you have worked in it, so that even if you expand projects and then collapse their parent nodes, the modified macro collapses all the projects correctly.

You can download the file modified by me in the file CollapseAllSolutionExplorer.vb.txt (I suggest you don't open it in your browser, but save it locally)

Installing ClearCase Remote Client for Visual Studio 2008 and 2010

Here is the guide to install ClearCase Remote Client 7.0.1 for Visual Studio 2008.

  1. If Visual Studio 2005 wasn't already installed, you have to create in the registry, under the node HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0, a string with name InstallDir and value the install path of Visual Studio 2008, tipically C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE.
  2. After that, install the client, downloaded from https://YourCCRCServer/ccrc/update/ccrcvsi_win32.zip
  3. Download the updates to the registrations specific for Visual Studio 2008 from ftp://ftp.software.ibm.com/software/rational/clearcase/7.0.1/VS2008_support/CC-CQ-VS2008.zip for 32 bit and from ftp://ftp.software.ibm.com/software/rational/clearcase/7.0.1/VS2008_support/CC-CQ-64_BIT-VS2008.rar for 64 bit.
    Extract the zip file, open with Notepad the file reg_VS2008.bat and change the initial assignements so that CC_for_VS=0 and CQ_for_VS=0 (but keep CCRC_for_VS=1).
  4. From the command prompt, go the folder with the extracted files and execute the file reg_VS2008.bat.
    If all went fine, from Visual Studio 2008 the top menu ClearCase should appear.

And here are the adjustments necessary for Visual Studio 2010.

  1. Download and extract the file from ftp://ftp.software.ibm.com/software/rational/clearcase/7.0.1/VS2010_support/CC_7.0.1_VS2010.zip.
  2. Modify the reg_VS2010.bat file so that CC_for_VS=0 and CQ_for_VS=0 (keep CCRC_for_VS=1).
  3. From the command prompt, go to the folder with the extracted files and execute the file reg_VS2010.bat.
    If all went fine, from Visual Studio 2010 the to menu ClearCase should appear.