Google
 
Showing posts with label Deployment. Show all posts
Showing posts with label Deployment. Show all posts

Friday, January 7, 2011

Failed to extract the cab file in the solution error in SharePoint

When deploying SharePoint solutions, you may encounter an error message like:
Failed to extract the cab file in the solution.
(FYI, the wsp solution file is a cab file. just try to rename *.wsp to *.cab)
There are two reasons that I found causing this kind of error:
  1. Having some special characters in files names in the solution, in my case it was "(" and ")".
  2. Having two DLLs with the same name even if one is in the GAC folder and the other in bin folder, this happened in my case by mistake, but it's good to know anyway.
Have a nice deployment, without uninformative error messages.

Friday, December 7, 2007

How to check programmatically if WSS or MOSS are installed

I came into a situation when I needed to check if a SharePoint installation exists on a system, and specifically, WSS (Windows SherePoint Servises) or MOSS (Microsoft Office SharePoint Server).

The two properties can be useful in this case, the idea depends on checking the registry.
Note that I extracted this code from the open source project SharePoint Solution Installer and made minor modifications.

To check for WSS we check the key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0]
and the value "SharePoint" must be "Installed"

To check for MOSS we check the key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0]
"BuildVersion"="12.0.4518.1016"
and check that the version is 12

Here is the code:

public static bool IsWSSInstalled
{
get
{
string name = @"SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0";

try
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(name);
if (key != null)
{
object val = key.GetValue("SharePoint");
if (val != null && val.Equals("Installed"))
{
return true;
}
}
return false;
}

catch (SecurityException ex)
{
throw new Exception("Access deined. Could not read the Windows Registry key '" + name + "'", ex);
}
}
}

public static bool IsMOSSInstalled
{
get
{
string name = @"SOFTWARE\Microsoft\Office Server\12.0";

try
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(name);
if (key != null)
{
string versionStr = key.GetValue("BuildVersion") as string;
if (versionStr != null)
{
Version buildVersion = new Version(versionStr);
if (buildVersion.Major == 12)
{
return true;
}
}
}
return false;
}

catch (SecurityException ex)
{
throw new Exception("Access deined. Could not read the Windows Registry key '" + name + "'", ex);
}
}
}

and at the top of your class:
using Microsoft.Win32;
using System.Security;

Wednesday, February 21, 2007

Tips for your next major deployment

Deployment is one of the most annoying steps in the software production process especially for developers. I hate it. A small missing configuration or permission can cause severe problems. worse can happen when applying a fix or an update.
I believe that software developers should not make the actual deployment. Software Implementors or system engineers are better at configuring things ;)

Here, I share some good points that can help making a peaceful deployment experience . Most of them apply mainly to web applications.

  1. Write a good deployment guide and test it before you deploy on production
  2. Create a brief yet complete check list.
  3. Peer check your deployment: another implementor or developer should review the steps you made.
  4. Automate the process of deployment as much as you can.
  5. If you deploy on a production environment, backup live data and configurations. You should also take the application offline.
  6. Use staging environments with the same configurations as the production servers.
  7. Test your deployment.