This project is read-only.

Project Description
This project is designed to assist the .NET developer who is migrating their C# code from the CRM 4.0 object model to the CRM 201x object model.

The initial purpose of the project is to generate Visual Studio macros which perform search and replace operations to which change the code from one syntax to the other.

It is planned that in a later stage of the project, we will read and covert source files directly.


The concept of this project is to convert, as much as possible, the old to the new. We are using standard Visual Studio search and replace operations to perform these tasks.


  • Download the existing macros and add them to Visual Studio
  • Modify the Crm project and change the output folder and the CRM connection information
  • Generate the Entity and Attribute macros and add them to Visual Studio


  • Make a copy of your Visual Studio solution
  • Open the sources files
  • Perform the search and replace operation, usually in this order:
    • CrmDataTypes
    • MainKeywords
    • PluginKeywords (if the file is a plugin)
    • EntityLogicalName (this is a generated macro)
    • Entity-specific macros (these are generated macros)


Note: The SearchAndReplaceMacro currently only works with the current document. It can be modified to work on the entire solution or project but I would advise caution when making such a change. In my experience, and depending on the types of Visual Studio add-ins installed, it is possible to crash Visual Studio by performing too many search and replace operations.

Existing Macros

CrmDataTypes.vb converts data many data types to the new CRM 201x object model.

MainKeywords.vb converts the standard keywords.

PluginKeywords.vb converts keywords related to plugins and custom workflow activities.

SearchAndReplaceMacro.vb is the macro that actually performs the search and replace function and is the macro used by all of the other macros.


Generated Macros

The macros generated by the CreateVisualStudioMacros project consist of two types:

  • Entity macro
  • Attribute/Field macros

There will be one EntityLogicalNames.vb macro created which renames all the entity schema names. The remainder of the macros will rename the attributes of individual Entities.

Once you have generated the macros, you will need to add them to Visual Studio for any developer who is working on the conversion.



The downloads area contains a ZIP file containing the following sub-folders:

CreateVisualSudioMacros Contains the command-line utility to generate Entity-based macros from a CRM organization.
Macros-Entity Contains macros generated from a standard CRM organization.
Macros-Main Contains the main search and replace macros.


Future Plans

In the future, the ProjectMigrator project will allow us to convert an entire Visual Studio solution en-masse by running all of the search and replace operations on individual source files.

ProjectMigrator will use the same search and replace operations as the macros, but using standard .NET technologies instead.


Would You Like to Help?

If you would like to contribute to the project, the please send me an email: mitch at crmaccelerators dot net.

We could use help in the following areas:

  • Creating unit tests to verify the conversion process
  • Locating and creating new search and replace operations
  • Add features and functionality to the ProjectMigrator project

Last edited Oct 14, 2016 at 2:45 PM by Jamie_Miley, version 7