Sunday, February 10, 2008

Scheduling planned shutdown of Windows 2003 server

To perform a planned shutdown of Windows 2003 server at a specified time, the following command can be used

at 3:00am shutdown /s /d p:1:1

Wednesday, February 6, 2008

Using VS 2008 Code Metrics tool for SharePoint projects.

I ran the Code Metrics tool on a VS 2008 project containing a set of SharePoint web parts. The tool failed to show code metrics for Projects that had a reference to Microsoft.SharePoint DLL. Given below is the message I received.

An error occurred while calculating code metrics for target file 'D:\MyFolder\Projects\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe' in project ConsoleApplication1. The following error was encountered while reading module 'Microsoft.SharePoint': Security attribute type does not have a default constructor: Microsoft.SharePoint.Security.SharePointPermissionAttribute, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, Publickeytoken=71e9bce111e9429c.

I found the same issue reported on Microsoft connect site, but it had been closed since Microsoft was unable to reproduce the issue. So I provided the steps to reproduce the issue and got back to my work.In the process, I created a dummy console application with a reference to Microsoft.SharePoint. After submitting the repro steps, I had a good look at the error message and thought: "What if I include a reference to the Microsoft.SharePoint.Security namespace? Will that help? Let me try..." I did that and ran the Code metric tool. Pronto, I had the code metrics for the SharePoint project in the Code Metric Results section!!! Doing something for the community somewhere down the line helps you, isn't it? :)

So if you run into a similar issue when using the Code Metrics tool, just add a reference to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.Security.dll" and re-calculate the code metrics.

What is success?

The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...