Monday, October 31, 2011

CheckAsm

If you know and use Dependency Walker (depends.exe), you will probably need CheckAsm too. CheckAsm is just "depends for .NET".
CheckAsm is an assembly dependency viewer. It shows all .NET assembly references of any .NET assembly. This means you can always find what references are incorrect, which assemblies are missing, and why your application can not start.

Tuesday, September 13, 2011

smtp4dev

Some of my colleagues pointed me at a little “SMTP Server”, called smtp4dev. It’s an SMTP server that listens on your local machine and captures all messages, which you can easily view and open. Very handy when you send email message in your application and you want to see how the message looks, without the requirement to install a real SMTP Server.


Other SMTP servers you could consider to use:
  1. Squirrelmail
  2. SurgeMail

Uninstall MSI which fails to uninstall

Uninstall MSI which fails to uninstall sounds like strange, but it is possible.

Sometimes when you try to uninstall a msi the msi fails to uninstall with an error message like, the screenshot below.
This could be caused by a custom action which fails to execute.

To indicate if this is really the problem run the uninstall with the following command:

C:\Temp\ Setup.msi /log c:\uninstall.log

(if you don’t know where the msi is located, search the registry on the product name and you will find it. You should search until you find a match in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData” like “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\B2729D7731537264797FB846DDDCF225\InstallProperties”)

The log file should now contain something like:
(The black line containing the name of the custom action). To make it possible to uninstall the product perform the following steps:
  1. Locate the msi in the C:\Windows\Installer\ (search in the registry on the product name and you will find it).
  2. Make a backup of the msi (you never know what happens)
  3. Open the original msi file in Orca.
  4.  Locate the CustomAction table.
  5.  Select the CustomAction which cause the problem.
  6.  Delete the selected custom action.
  7. Save the msi and close Orca.

Thursday, January 13, 2011

HowTo - SharePoint - Build a WSP for an Index Server

I created a solution for SharePoint which must be installed on all the Index Servers in a Farm. So I build a WSP solution with WSPBuilder and I thought that would be it. Because had some code in the feature activate of one of my feature, I thought let’s test the wsp in an environment where my Index Server is a dedicated Index Server (so not a Frontend Server).


To my astonishment, I found out that the WSP was only deployed to all the Frontend servers in my Farm but not to the Index Server :(

Cause

A wsp contains a manifest.xml, which looks like this:

 
 
 
 
 
 
 
 
 


 
When you build a WSP using WSPBuilder, by default the Solution element does not contain a DeploymentServerType attribute, which is the cause of the problem. The DeploymentServerType has the following description:

DeploymentServerType : Optional. Default=WebFrontEnd. This attribute indicates the target of your solution to either a web front end server (WebFrontEnd) or an application server (ApplicationServer).

Solution


Make sure the DeploymentServerType is specified in the manifest.xml. To accomplish this, you need to edit the WSPBuilder.exe.config (in my case in the folder C:\Program Files\WSPTools\WSPBuilderExtensions), and add the attribute DeploymentServerType.


 
 
 

Tuesday, January 11, 2011

HowTo - SharePoint - Get a list of SSPs in code

Ever wanted to get a list of all the Shared Services Provider (SSP) in a SharePoint Farm, for example to retrieve all the search service instances in a Farm?


To accomplish this, we need to walk through all the web application and determine if the web application is a SSP web application. We can do this by validating if the web application contains a property called “Microsoft.Office.Server.SharedResourceProvider”. The property “” contains a property “AdministrationSiteId”, which is the id of the SSP Administrator Site.

Remark: in most situation we will get two web applications, for a single SSP, with the “Microsoft.Office.Server.SharedResourceProvider” property. This because in most situation we have a Search web application and a MySite web application for a SSP.

The code will look like this:

 private StringCollection GetAdminSiteIDs(SPFarm farm)
{
   StringCollection colAdminSites=new StringCollection();
   SPWebService webService = farm.Services.GetValue();
   foreach (SPWebApplication webApp in webService.WebApplications)
   {
      //Check if the web app contains a property Microsoft.Office.Server.SharedResourceProvider,
      //which indicates it's a SharedResourceProvider.
      if (webApp.Properties.ContainsKey("Microsoft.Office.Server.SharedResourceProvider"))
         {
            object ssp = webApp.Properties["Microsoft.Office.Server.SharedResourceProvider"];
            
            //Get the guid of the Administration Site
            Guid sspGuid = (Guid)ssp.GetType().GetProperty("AdministrationSiteId").GetValue(ssp, null);

            //Check if the site is already processed, because for each SSP, we get two SharedResourceProvider
            //one Search and one MySite.
            if (!colAdminSites.Contains(sspGuid.ToString()))
            { 
               colAdminSites.Add(sspGuid.ToString());
            }
         }
   }
   return colAdminSites;
}

Wednesday, August 25, 2010

How to boot from Microsoft SharePoint 2010 VHD using Windows 7

This post describes the steps to boot your computer from the Microsoft SharePoint 2010 VHD (2010 Information Worker Demonstration and Evaluation Virtual Machine )


  • Download the VHD.
  • Run the command compmgmt.msc.
  • Right mouse click on Disk Management and click Attach VHD.

  • Click Browse and select the vhd from which you want to boot.
  • The vhd should now be visible as a disk and you should be able to browse the vhd in the Windows Explorer.
  • Open command prompt (As Administrator).
  • Type the command bcdedit /copy {current} /d "VHD_Boot" You should see a message like the one below.

  • Copy the guid from the success message from step 1, and run the command:
bcdedit /set {CLSID_Number} osdevice vhd=[C:]\2010-7a.vhd

  • Now restart your computer, and you should be able to boot from the vhd, and you should see something like the figure below:


Tuesday, August 10, 2010

Just a test to see if SyntaxHighlighter is working ok

/// 
/// Just a HelloWord method to test the SyntaxHighlighter on my blog.
/// 
public void HelloWorld()
{
       Page.Response.Write("SyntaxHighlighter Test");
}