Creating a Commerce Server Package for the Project Creation Wizard

When you build a custom Commerce Server Site package to work with the Custom option of the Project Creation Wizard, you must create template site files for that package. The template site files are a collection of text files that contain some simple directives. They are parsed and rendered according to user input to the wizard and then added to the Commerce Server project. The information for parsing the templates is obtained by directly accessing the symbol table of the Project Creation Wizard.

Commerce Server Site files follow a template structure similar to the one defined by Visual Studio .NET. For information about template directives used in the Project Creation Wizard template file, see "Template Directives" in Microsoft Visual Studio .NET Help.

Any site that contains template files must include a file named template.ini. This file can be empty of content and will be deleted at the end of the wizard process. It merely signals that the files should be parsed for symbols.

The site must include a web.config file with a valid defaultLanguage attribute on the compilation node. The defaultLanguage attribute must be set to either c# (C#) or vb (Visual Basic .NET).

Ee826051.note(en-US,CS.20).gifNotes

  • In Commerce Server 2002, Visual Basic .NET and C# are the only languages supported by the Project Creation Wizard.
  • If the file DynamicDisco.disco is present in the root directory of the site, the Project Creation Wizard will be rename it to <sitename>.disco.

Commerce Server Variables

Sample C# Form Page

Sample C# Codebehind Page

Sample C# AssemblyInfo.vb Page

Sample Visual Basic .NET Form Page

Sample Visual Basic .NET Codebehind Page

Sample Visual Basic .NET AssemblyInfo.vb page

Commerce Server Variables

You use the following Commerce Server variables when creating the Project Creation Wizard template files:

Variable Description
WIZARD_NAME Specifies the name of the wizard.

WIZARD_NAME will always be Commerce Custom Web Project for package files processed by the Custom option of the Project Creation Wizard.

PROJECT_TYPE Specifies the Visual Studio .NET project type.

This will be either VBPROJ or CSPROJ, and is determined by the defaultLanguage attribute of the compilation tag in the site's web.config file.

The defaultLanguage attribute must be set to either c# (C#) or vb (Visual Basic .NET).

Ee826051.note(en-US,CS.20).gifNote

  • In Commerce Server 2002, Visual Basic .NET and C# are the only languages supported by the Project Creation Wizard.
SHARED_PATH Specifies the shared commerce files folder.

SHARED_PATH is usually set to: <drive>:\Program Files\Common Files\Microsoft Shared\Enterprise Servers\Commerce.

COMMERCE_PATH Specifies the Commerce Server install path.

COMMERCE_PATH is usually set to: <drive>:\Program Files\Microsoft Commerce Server 2002.

DEFAULT_SERVER_SCRIPT Specifies the default server script language.

DEFAULT_SERVER_SCRIPT is either JavaScript or VBScript depending upon the default settings of the user.

DEFAULT_CLIENT_SCRIPT Specifies the default server script language.

DEFAULT_CLIENT_SCRIPT is either JavaScript or VBScript depending upon the default settings of the user.

DEFAULT_TARGET_SCHEMA Specifies one of the following target schemas depending upon the default settings of the user: https://schemas.microsoft.com/intellisense/ie3-2nav3-0, https://schemas.microsoft.com/intellisense/ie5, or https://schemas.microsoft.com/intellisense/nav4-0.
DEFAULT_HTML_LAYOUT Specifies either FlowLayout or GridLayout depending upon the default settings of the user.
GUID_ASSEMBLY Specifies the assembly GUID for use in an assemblyinfo.vb file (if present).
SAFE_CLASS_NAME Specifies the safe class name for the current page.

This symbol is only available for C# projects.

SAFE_NAMESPACE_NAME Specifies the safe namespace for the current project.

This symbol is only available for C# projects.

SAFE_ITEM_NAME Specifies the safe class name for the current page.

This symbol is only available for C# projects.

Sample C# Form Page

Following is a sample form page in C#:

<%@ Page language="c#" Codebehind="$FILENAME$.cs" AutoEventWireup="false" Inherits="$INHERITS$" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 

<html>
  <head>
    <title>[!output SAFE_ITEM_NAME]</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="[!output DEFAULT_CLIENT_SCRIPT]">
    <meta name=vs_targetSchema content="[!output DEFAULT_TARGET_SCHEMA]">
  </head>
  <body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">

    <form id="Form1" method="post" >

    </form>

  </body>
</html>

Sample C# Codebehind Page

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.CommerceServer.Runtime;

namespace [!output PROJECT_NAME]
{
   /// <summary>
   /// Summary description for _Default.
   /// </summary>
   public class _Default : System.Web.UI.Page
   {
      private void Page_Load(object sender, System.EventArgs e)
      {
         // Put user code to initialize the page here
      }

      #region Web Form Designer generated code
      override protected void OnInit(EventArgs e)
      {
         //
         // CODEGEN: This call is required by the ASP.NET Web Form Designer.
         //
         InitializeComponent();
         base.OnInit(e);
      }
      
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      private void InitializeComponent()
      {    
         this.Load += new System.EventHandler(this.Page_Load);
      }
      #endregion
   }
}

Sample C# AssemblyInfo.vb Page

Following is a sample assemblyinfo.vb page in C#:

using System.Reflection;
using System.Runtime.CompilerServices;

//
// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]      

//
// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.*")]

//
// In order to sign your assembly you must specify a key to use. Refer to the 
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing. 
//
// Notes: 
//   (*) If no key is specified, the assembly is not signed.
//   (*) KeyName refers to a key that has been installed in the Crypto Service
//       Provider (CSP) on your machine. KeyFile refers to a file which contains
//       a key.
//   (*) If the KeyFile and the KeyName values are both specified, the 
//       following processing occurs:
//       (1) If the KeyName can be found in the CSP, that key is used.
//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
//           in the KeyFile is installed into the CSP and used.
//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
//        When specifying the KeyFile, the location of the KeyFile should be
//        relative to the "project output directory". The location of the project output
//        directory is dependent on whether you are working with a local or web project.
//        For local projects, the project output directory is defined as
//       <Project Directory>\obj\<Configuration>. For example, if your KeyFile is
//       located in the project directory, you would specify the AssemblyKeyFile 
//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
//        For web projects, the project output directory is defined as
//       %HOMEPATH%\VSWebCache\<Machine Name>\<Project Directory>\obj\<Configuration>.
//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
//       documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

Sample Visual Basic .NET Form Page

Following is a sample form page in Visual Basic .NET:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="$FILENAME$.vb" Inherits="$INHERITS$"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>[!output SAFE_ITEM_NAME]</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name=vs_defaultClientScript content="[!output DEFAULT_CLIENT_SCRIPT]">
    <meta name=vs_targetSchema content="[!output DEFAULT_TARGET_SCHEMA]">
  </head>
  <body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">

    <form id="Form1" method="post" >

    </form>

  </body>
</html>

Sample Visual Basic .NET Codebehind Page

Following is a sample codebehind page in Visual Basic .NET:

Imports Microsoft.CommerceServer.Runtime

Public Class _Default
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

End Class

Sample Visual Basic .NET AssemblyInfo.vb Page

Following is a sample assemblyinfo.vb page in Visual Basic .NET:

Imports System.Reflection
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following 
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("")> 
<Assembly: AssemblyDescription("")> 
<Assembly: AssemblyCompany("")> 
<Assembly: AssemblyProduct("")> 
<Assembly: AssemblyCopyright("")> 
<Assembly: AssemblyTrademark("")> 
<Assembly: CLSCompliant(True)> 

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("[!output GUID_ASSEMBLY]")> 

' Version information for an assembly consists of the following four values:
'
'      Major Version
'      Minor Version 
'      Build Number
'      Revision
'
' You can specify all the values or you can default the Build and Revision Numbers 
' by using the '*' as shown below:

<Assembly: AssemblyVersion("1.0.*")>

See Also

Creating a Commerce Project

Copyright © 2005 Microsoft Corporation.
All rights reserved.