In order to complete the upgrade, you must have the following installed on your computer:
· .NET Framework 3.0 (not necessary if you use Windows Vista).
· Visual Studio .NET 2005 (Team Edition for Software Testers recommended).
· Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF) (required to create a disconnected service agent for a WCF proxy and to use CAB-WPF Extensions which enable you to define WPF controls as SmartParts).
· Guidance Automation Extensions February 2007 CTP.
· Guidance Automation Toolkit.
· Smart Client Software Factory - May 2007.
To upgrade your solution, you will create a new smart client solution using the Smart Client Solution template and then you will add your solution’s modules and Shell project to the new solution.
1. In Visual Studio, point to New on the File menu, and then click Project.
Figure 1
The Smart Client Application solution templates.
2. In the New Project dialog box, expand the Guidance Packages node. Click the Smart Client Development May 2007 project type.
3. In the Templates window, select Smart Client Application (C#) or Smart Client Application (Visual Basic) (depending on the language you’ve coded the CAB application).
4. Change the Name.
5. (Optional) Change the location for the solution.
6. Click OK.
Figure 2
The Create Solution recipe wizard.
7. Enter the location of the Composite UI Application Block, Enterprise Library, and the offline application blocks assemblies.
8. Enter the Root namespace for your application.
9. Unselect the option Create a separate module to define the layout for the shell.
10. (Optional) Select the Allow solution to host WPF SmartParts check box (if your solution contains or will contain WPF SmartParts).
11. (Optional) Select the Show documentation after recipe completes check box.
12. Click Finish.
Figure 3
The smart client solution structure.
In this task you will add your CAB application to the new Smart Client solution and configure it according to the SCSF structure.
1. Copy your old CAB application to the Source folder located inside the new Smart Client solution root folder.
2. In Solution Explorer, right-click the Source solution folder, point to Add, and then click Existing Project.
3. Browse the directory of the old CAB application and add one of the module projects (i.e.: your CAB Shell module project).
Figure 4
CAB Shell module project added.
4. Repeat steps 2 and 3 until all of the modules have been added.
5. Right-click your CAB Shell and select Set as StartUp Project.
6. For each module, right-click the project and select Add Reference. In the Projects tab, select the Infrastructure.Interface and Infrastructure.Library projects and click OK.
7. For each module, replace the Microsoft.Practices.* assemblies with the ones located in %RootSolutionFolder%\Lib. If you have references to the CompositeUI and CompositeUI.WinForms projects, replace those references to the assemblies located in % RootSolutionFolder %\Lib.
Note: % RootSolutionFolder %\Lib is the directory of the root folder where you placed the new Smart Client solution.
8. For each module, right-click the project and select Properties. In the Build tab, go to the Output section and edit the Output path to RootSolutionFolder%\bin\Debug.
Figure 5
Output path in the Output section located at Build tab in the Module properties. Note: you might not see a relative path until you close the properties window and open it again.
In this task you will remove the Smart Client Shell template project.
1. In Solution Explorer, right-click the Infrastructure.Shell project and then click Remove.
Figure 6
Removing the SCSF Shell project.
2. Delete the Source\Infrastructure\Shell folder located in within the root folder of the solution.
Figure 7
Deleting the SCSF Shell folder.
In this task you will upgrade the Shell of your CAB application in order to replace the Smart Client Shell project.
1. In Solution Explorer, expand your Shell project, open the ProfileCatalog.xml file and update it to match the schema used in SCSF solutions. For example, if your profile catalog looks like this:
XML
<?xml version="1.0" encoding="utf-8" ?>
<SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile" >
<Modules>
<!-- some modules -->
</Modules>
</SolutionProfile>
You have to update it to look like this:
XML
<SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile/2.0">
<Section Name="Services">
<Modules>
<ModuleInfo AssemblyFile="Infrastructure.Module.dll" /> <!-- THIS IS REQUIRED FOR SC-SF SOLUTIONS -->
<!-- PLACE INFRASTRUCTURE (FOUNDATIONAL) MODULES HERE -->
</Modules>
</Section>
<Section Name="Apps">
<Dependencies>
<Dependency Name="Services" />
</Dependencies>
<Modules>
<!-- PLACE BUSINESS MODULES HERE -->
</Modules>
</Section>
</SolutionProfile>
2. Click Save and close the file.
3. Now, right-click your ShellApplication.cs file and select View Code.
4. Add the following statement:
Visual Basic
Imports %RootNamespace%.Infrastructure.Library;
C#
using %RootNamespace%.Infrastructure.Library;
Note: %RootNamespace% must be replaced with the RootNamespace you specified when you created the Smart Client solution.
5. Update the class signature to inherit from FormShellApplication<TWorkItem, TShell> instead of SmartClientApplication<TWorkItem, TShell>.
6. Click Save.
In this task you will modify the yourSolution.sln file in order to finish setting the Shell of the CAB application as the Smart Client Shell.
1. In the root folder of your solution, right-click the .sln file, select Open with and then select the NotePad.
2. Locate the Project section for the Shell project.
Figure 8
ShellpProject section.
3. Copy to the clipboard the GUID that appears after the project location (its format is “XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX”).
Figure 9
The GUID that appears after the project location.
4. Locate the line GlobalSection(ExtensibilityGlobals) = postSolution.
5. Replace the GUID specified in the ShellProjectGuid property with your Shell project’s GUID.
Figure 10
ShellProjectGuid.
6. Save and close the file.
In this task you will finish building and running your upgraded solution.
1. Go back to Visual Studio. A message saying that the solution has been modified outside of the development environment will appear. Click Reload to reload the solution.
2. Build and run the application.
至此,迁移成功!