Prepare Web Site Script

Overview

By default, the object of each Translation Script is a single migration unit: a VBP or an ASP page; and it produces a single .NET project (csproj or vbproj) as output. This is appropriate for VBPs. However, when you are migrating a web site you will want to create a Multi-unit Translation Script that directs the conversion of all the top-level pages that make up the site. Translating this script will produce a single web application project that can be used to direct the build of the entire web site. The benefits of web application projects are described on MSDN.

Web Script Setup

The procedure for creating a Multi-unit Script for a web site is described here:

  1. Set the Content Type for all files in the web migration project
    (a) Press CTRL-A
    (b) Click [Tools/Set Build Order] from the menu
     
  2. Filter the task list to display only Page files.
    (a) Click [Filter] on the Toolbar
    (b) Enter "PAGE" in the BLDTYP field (without quotes)
    (c) Click Save
     
  3. Select all Page files.
    Press CTRL-A
     
  4. Generate a Multi-unit Script for the Page files.
    Click [Reports/Multi-Unit Script] from the menu

The process above will do several things:
  • Create a web site migration script and place it in the workspace\usr folder  
  • Add a web site translation task to your migration project with name = "ALLJOBS"  
  • Display the new script in the text editor.

You can optimize your site script by adding registry commands, reference commands, or other refactoring directives.  For example, the listing below is the Multi-unit Script for the DemoFMSweb_csh sample.  First created by gmStudio, this script was manually edited to include the following sections:

  • Lines 30-33: References to the COM DLLs used by the site. Note that these are actually references to the IDFs generated when the DemoFMSLib_csh migration project is translated.
     
  • Lines 36-38: A one-off migration rule to instruct the system that the ADODB.Field may contain DBNull and needs special handling.
     
  • Lines 77-172: Various target edits to clean up the csproj file and make it easier to work with. Alternatively, these edits could be made the default for all migrations by modifying the system configuration file, RUNTIME.XML, if desired.


<gmBasic>
<Storage Action="Create" Identifier="%JobId%"/>

   <!-- Translation Options -->
   <Select progress="1"/>
   <Select Dialect="%Dialect%"/>
   <Select CheckUUIDS="off"/>
   <Select AuthorLibrary="off"/>
   <Select NullOrEmpty="On"/>
   <Select SingleQuotes="On"/>
   <Select DevEnv="%DevEnv%" />

   <!-- Environmental Information -->
   <select VirtualRoot="%VirtualRoot%" />
   <select DeployLocation="%NetProjFolder%" />
   <select Library="%InteropFolder%" />

   <!-- C# Web Application Project GUIDS -->
   <Registry type="guid" source="Project" target="{7EE74E01-07B7-4C4F-B053-895BB67A3A51}" />
   <Registry type="guid" source="ProjectType1" target="{349c5851-65df-11da-9384-00065b846f21}" />
   <Registry type="guid" source="ProjectType2" target="{fae04ec0-301f-11d3-bf4b-00c04f79efbc}" />
   <Registry type="guid" source="Flavor" target="{349c5851-65df-11da-9384-00065b846f21}" />

   <!-- Config search Paths -->
   <Select Target="%UserFolder%" />
   <Select Local="%IdfFromCodeFolder%" />
   <Select System="%IdfFromIdlFolder%" />

   <!-- COM References -->
   <Reference id="FMStocks_DB.dll"/>
   <Reference id="FMStocks_Bus.dll"/>
   <Reference id="FMSStore_Bus.dll"/>
   <Reference id="FMStocks_Ext.dll"/>

   <!-- One-off migration rules -->
   <Refactor id="[msado27.tlb]" >
      <Migrate id="Field20.Value" CanBeNull="on" />
   </Refactor>

   <!-- Compile the site -->
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\_about.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\_GetXMLPortfolio.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\_GetXMLTickerHistory.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\_NewAccount.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\_runsql.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\_version.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\401k.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\AccountSummary.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\browse.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\BuyStock.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\cart.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\ChartPortfolio.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\checkout.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\default.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\FindProduct.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\Home.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\Logout.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\news.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\OfflinePortfolio.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\Portfolio.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\SellStock.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\SellStockAction.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\SellStockReceipt.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\store.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\template.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\TickerDetail.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\TickerList.asp" />
   <Compile PageSlice="C:\gms\samples\source\FMStocks\FMSWeb\ASP\ViewProduct.asp" />

   <!-- Apply Migration Rules -->
   <Analyse/>

   <!-- Apply final edits and author the migration  -->
   <Output  Status="New" Filename="%BndPath%"/>
   <Author name="%MigName%">

   <Fix host="WebProjectFile">

   <Replace name="Upgrade: Add AspNetCompilerTask to the project to allow verify by build">
      <OldBlock><![CDATA[
         <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
            Other similar extension points exist, see Microsoft.Common.targets.
         <Target Name="BeforeBuild">
         </Target>
         <Target Name="AfterBuild">
         </Target>
         -->
      ]]></OldBlock>
      <NewBlock><![CDATA[
         <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
            Other similar extension points exist, see Microsoft.Common.targets.
         <Target Name="BeforeBuild">
         </Target>
         <Target Name="AfterBuild">
         </Target>
         -->
         <Target Name="AfterBuild">
              <AspNetCompiler
                  VirtualPath="/%MigName%"
                  PhysicalPath="%NetProjFolder%"
                  TargetPath="%NetProjFolder%_build"
                  Force="true"
                  Debug="true"
              />
         </Target>
      ]]></NewBlock>
   </Replace>

   <Replace name="C: Cleanup unused references">
   <OldBlock><![CDATA[
      <Reference Include="System" />
      <Reference Include="System.Data" />
      <Reference Include="System.Drawing" />
      <Reference Include="System.Web" />
      <Reference Include="System.Xml" />
      <Reference Include="System.Configuration" />
      <Reference Include="System.Web.Services" />
      <Reference Include="System.EnterpriseServices" />
      <Reference Include="System.Web.Mobile" />
      <Reference Include="Microsoft.VisualBasic" />
      <Reference Include="System.Windows.Forms"/>
   </ItemGroup>
   <ItemGroup>
      <Import Include="Microsoft.VisualBasic" />
      <Import Include="Microsoft.VisualBasic.CompilerServices" />
      <Import Include="System" />
      <Import Include="System.Collections" />
      <Import Include="System.Data" />
      <Import Include="System.Diagnostics" />
      <Import Include="System.Drawing" />
      <Import Include="System.Windows.Forms" />
   </ItemGroup>
   ]]></OldBlock>
   <NewBlock><![CDATA[
       <Reference Include="System" />
       <Reference Include="System.Web" />
       <Reference Include="Microsoft.VisualBasic" />
       <Reference Include="System.Windows.Forms"/>
     </ItemGroup>
     <ItemGroup>
       <Import Include="Microsoft.VisualBasic" />
       <Import Include="Microsoft.VisualBasic.CompilerServices" />
       <Import Include="System" />
       <Import Include="System.Collections" />
       <Import Include="System.Diagnostics" />
       <Import Include="System.Windows.Forms" />
     </ItemGroup>
   ]]></NewBlock>
   </Replace>

   <Replace name="U: Set virtual root for IDE">
   <OldBlock><![CDATA[<DevelopmentServerVPath>/</DevelopmentServerVPath>]]></OldBlock>
   <NewBlock><![CDATA[<DevelopmentServerVPath>/%MigName%/</DevelopmentServerVPath>]]></NewBlock>
   </Replace>

   </Fix>

   <Fix name="fixes to pages/code">

      <Replace name="C: Cleanup unused references">
      <OldBlock><![CDATA[
      using System;
      using System.Data;
      using System.Configuration;
      ]]></OldBlock>
      <NewBlock><![CDATA[
      using System;
      using System.Configuration;
      ]]></NewBlock>
      </Replace>

   </Fix>
   </Author>

<Storage Action="Close"/>
</gmBasic>