This project is read-only.

Commerce Server Code Generation Nuget Package

The Commerce Server Code Generation nuget package is used to add configuration and T4 files to your project in order to generate typed Commerce Entities and static methods for accessing Commerce Server Request Templates.


You'll need to have your web project configured to use Commerce Server. You can either do this manually or use one of the Nuget packages available to configure Commerce Server. Either setup a Foundation service, then Presentation service and add the Code Generation to the Presentation project or configure a Two-Tier project.

The Code Generation packages also uses the CommerceServerContrib libraries. You don't have to worry about installing them as Nuget will take care of that for you.


This packages adds a number of T4 templates to the project. A number of them are run automatically to generate helper classes based on your solution. Two need to be run explicitly after a rebuild.

How to use this package

After adding the package build your project. When the build completes go to the Models folder and open the file and save it. You don't have to make any modifications - the save action alone will cause Visual Studio to run the template. Using the CommerceServerContrib.CodeGeneration.dll the template will use your projects configuration (web.config) to access Commerce Server and generate a partial class for each entity defined in the metadata system.

After that has completed go to the RequestTemplates folder, open and save. This will generate static classes with methods for each of the Request Templates defined in your Commerce Server deployment.

You can download the source of the package and modify it for your own use if you want.

Last edited Nov 20, 2012 at 9:11 PM by bthubbard, version 1


No comments yet.