Archive for September, 2008

Smart Client Software Factory (SCSF) GP source code with Installer that works on Visual Studio 2008 + SP1

A couple of months ago I announced in my blog that the P&P Sustained Engineering team had published an article in the SCSF Knowledge Base that describes the Known Issues and Fixes for the SCSF - April 2008 release running with Microsoft Visual Studio 2008 Service Pack 1.

The fixes for these issues included modifying the guidance package source code and register a custom one. So I decided to post the source code with the fixes including a setup project in order to create an installer for it.

Download it from here.

Disclaimer: This is not an official Microsoft release. Use it at your own risk.

Registering the Guidance Package using the installer

To register the guidance package using the custom installer performs the following steps:

  1. Open and build the GuidancePackage.sln solution to generate the installer.
  2. Navigate to the SmartClientFactorySetup\Debug folder.
  3. Close all instances of Visual Studio.
  4. Run the SmartClientFactoryPackageSetup.msi installer.
    Note: If you are running on Vista with the User Account Control (UAC) activated, you must run the installer with the option Run as administrator.

Manually registering the Guidance Package

To manually register the guidance package perform the following steps:

  1. Open the GuidancePackage.sln solution.
    Note: If you are running on Vista with the User Account Control (UAC) activated, you must open Visual Studio with the option Run as administrator.
  2. On the Tools menu of Visual Studio, click Guidance Package Manager.
  3. In the Guidance Package Manager dialog box, click Enable / Disable Packages.
  4. In the Enable and Disable Packages dialog box, select the Guidance Package Development check box.
  5. Click OK.
    Enabling the Guidance Package Development allows you to register a guidance package.
  6. Close all other instances of Visual Studio.
  7. Right-click the SmartClientFactoryPackage project, and then click Register Guidance Package.

For more information you can check the following article:

Using the Fixed Guidance Package

Once you have installed/registered the guidance package, you will be able to use the Smart Client Development for SP1 package (see the image below).

SmartClientDevelopmentForSP1

Enjoy.

Enabling CWAB and Unity in SharePoint applications sets of guidance published

The Patterns & Practices Sustained Engineering has just published two sets of guidance for SharePoint to make Web Parts more testable. The approach is enabling a dependency injection container in SharePoint applications. You can download these new releases from here:

Each of the releases include the following elements:

  • A PDF document with guidance to enable CWAB/Unity in a SharePoint application to make Web Parts more testable.
  • Extensions for CWAB/Unity to work on a SharePoint application
    • CompositeWeb.SharePoint solution: it includes a class that implements the IWebClientApplication interface and inherits from SPHttpApplication class.
    • Unity.SharePoint solution: it includes a class that inherits from SPHttpApplication and hosts a Unity container.
  • A sample implementation that uses the extensions for CWAB/Unity. This solution includes a Web Part that is injected with dependencies (also has a Unit Test project).
  • Sample files like the global.asax and web.config for a SharePoint application enabled with CWAB/Unity.

SharePoint Releases

We also published the documentation guidance in the WCSF KB as wiki pages. You can find them here:

Enjoy

Workaround for DeckWorkspace issue: The smartpart is not present in the workspace

There are several questions in the SCSF forums asking about this excepction: The smartpart is not present in the workspace, when using the DeckWorkspace.

Symptom

When you show several views in the same DeckWorkspace and then close the application or terminate the parent WorkItem, you get the following exception:

Exception

Cause

Every time a Smartpart is closed in a DeckWorkspace it is removed from its Controls collection. Then the ActivateTopmost method is called to show the previously shown Smartpart. That method takes the first element in the Controls collection of the DeckWorkspace and activates it (this.Controls[0]).

When the Shell is being closed (by closing the application), the DeckWorkspace is disposed and starts to dispose all of its child elements. Therefore, because the DeckWorkspace is being disposed, the Controls collection cannot be modified.

Consequently, when the Smarparts in the DeckWorkspace begin to get closed, they cannot be removed from the Controls collection (because it is being disposed). The ActivateTopmost method then receives a Smartpart that is no longer present in the DeckWorkspace and tries to activate it. This causes the “The SmartPart is not present in workspace” exception.

Workaround

Modify the Deckworkspace source code (you will need to have the SCSF source code installed) to avoid activating the previous Smartpart when the workspace is being disposed.

You can perform the following steps to get this done:

  1. Open the CompositeUI-CS.sln solution.
  2. Right-click in the DeckWorkspace.cs file located in the Workspaces folder in the CompositeUI.WinForms project and select the View Code option.
  3. Replace the OnClose method for the following one:
    protected virtual void OnClose(Control smartPart)
    {
        this.Controls.Remove(smartPart);
    
        smartPart.Disposed -= ControlDisposed;
    
        if (!Disposing)
        {
            ActivateTopmost();
        }
    }

  4. Build the solution.
  5. Copy the recompiled CAB assemblies to the Lib folder of your SCSF solution.
Technorati Tags: ,

WPF Quickstart (shipped with SCSF) regenerated using Composite WPF (Prism)

We published in the CompositeWPFContrib web site a new sample application. This application is the WPF Quickstart (shipped with the SCSF source code) regenerated using the Composite Application Guidance for WPF. We used this sample application while drafting the Composite Application Guidance for CAB Developers document.

You can find this sample in the last Change Set of the CompositeWPFContrib source code or download it from here.
DifferentComponents

This new sample also includes documentation about how the regeneration was performed. This document is available in the Documentation section of the CompositeWPFContrib web site:

Document

Related Resources

If you are interesting in migration scenarios you may find useful the following links: