The following article will explain how to upgrade your existing Adxstudio xRM Extensions installation from version 2.2 to version 4.x


  1. Upgrade Your Existing Microsoft Dynamics® CRM 4 to CRM 2011

    For help with upgrading CRM please visit the Microsoft Dynamics CRM website. Additionally, due to how CRM 2011 upgrades picklist attributes into option sets, prior to the upgrade it is necessary to set the default customization prefix for the organization to "adx_".

  2. Download and Install XrmPortals.msi

    Note that Adxstudio Portals for Microsoft Dynamics® CRM 2011 requires .NET Framework 4.0. Development requires Microsoft Visual Studio 2010.

  3. Backup Your CRM Organization Database

    Please refer to the following article for help with backing up your database.

  4. Install the MicrosoftXrmCustomerPortal Solution Into Your CRM Organization

    This solution package can be found in the Customizations sub-directory of the Adxstudio Portals installation directory. Prior to the installation of this solution, it is necessary to deactivate and delete the custom workflow process "MSA-Event Management: Attendee Post Event Process", if it exists. Otherwise, installation of the solution may fail.

  5. Install the AdxstudioXrmPortals Solution Into Your CRM Organization

    This solution package can be found in the Customizations sub-directory of the Adxstudio Portals installation directory.

  6. Publish All Customizations

    For more information regarding installing customizations, please visit this page.

Run CrmSvcUtil

  • Run CrmSvcUtil and add the generated context class file to your existing Visual Studio Class Library Project and overwrite the existing context class file.

 For more information regarding CrmSvcUtil, please visit the following page

Update web configurations

  • Update your configurations in the web.config file

 For a complete list of configuration changes please view the following article

Update your Visual Studio Solution

  • Convert your Visual Studio 2008 Solution to Visual Studio 2010:
    • When opening a VS 2008 Solution in VS 2010, the Visual Studio Conversion Wizard will automatically display asking if you would like to convert your Solution.  Follow the directions in the wizard. When asked if you want to upgrade the Web site to use .NET Framework version 4.0, click ‘Yes’.
  • Modify the Visual Studio Class Library Project that contains the generated context class:
    • Update the project’s Target Framework to .Net Framework 4
    • Removereferences to the following libraries:
      • Adxstudio.Microsoft.Crm
      • Adxstudio.Xrm
      • microsoft.crm.sdk
      • microsoft.crm.sdktypeproxy
      • microsoft.crm.sdktypeproxy.xmlserializers
    • Adda reference to the following libraries: Located in (C:\Program Files\Adxstudio\XrmExtensions\4.0.0000\Framework\)
      • Microsoft.Xrm.Sdk.dll
      • Microsoft.Xrm.Client.dll
      • Microsoft.Xrm.Portal.dll
    • Adda reference to the following .NET library
      • System.Runtime.Serialization.dll
    • Clean and Build this Visual Studio Class Library Project
  • Modify the Visual Studio Web Application project of your portal:
    • Addreferences to the following libraries (Located in C:\Program Files\Adxstudio\XrmExtensions\4.0.0000\Framework)
      • Microsoft.Xrm.Sdk.dll
      • Microsoft.Crm.Sdk.Proxy.dll
      • Microsoft.Xrm.Client.dll
      • Microsoft.Xrm.Portal.dll
      • Microsoft.Xrm.Portal.Files.dll
    • Adda reference to the following .NET library:
      • System.Runtime.Serialization.dll
    • Form.browser file is no longer required; the App_Browsers folder can be deleted.

Code changes

A majority of the revisions consists of namespace and context changes.

  • Remove using Adxstudio.Microsoft.Crm;
  • Replace using Adxstudio.Xrm.Core; with using Microsoft.Xrm.Portal.Core;
  • Replace using Adxstudio.Microsoft.Crm.Data; with using Microsoft.Xrm.Client.Data;
  • Replace using Adxstudio.Microsoft.Crm.Data.Services; with using Microsoft.Xrm.Client.Data.Services;
  • Replace using using Adxstudio.Microsoft.Crm.Services; with using Microsoft.Xrm.Client.Services;
  • Replace using Adxstudio.Xrm.Web.Security; with using Microsoft.Xrm.Portal.Web.Security;
  • Replace using Adxstudio.Xrm.Web.Data.Services; with using Microsoft.Xrm.Portal.Web.Data.Services;
  • Replace using Adxstudio.Microsoft.Crm.Configuration; with using Adxstudio.Xrm.Configuration;
  • Replace using Adxstudio.Microsoft.Crm.Security; with using Microsoft.Xrm.Client.Security;
  • Replace using Adxstudio.Xrm.Web; with using Microsoft.Xrm.Portal.Web; (Except in JobPostings.ashx.cs and surveyReport.ashx.cs)
  • Replace using Adxstudio.Xrm.Cms; with using Microsoft.Xrm.Portal.Cms; (Except in PageRatings.ascx.cs and PageComments.ascx.cs, Forums.aspx.cs, Events.aspx.cs, Tag.aspx.cs, EventCalendar.ascx.cs, Surveys.aspx.cs)
  • Replace Adxstudio.Microsoft.Crm.UI with Microsoft.Xrm.Portal.Web.UI.WebControls
  • Replace Adxstudio.Xrm.Access with Microsoft.Xrm.Portal.Access
  • Replace Adxstudio.Xrm.Core with Microsoft.Xrm.Portal.Core
  • Replace Adxstudio.Microsoft.Crm.ICrmEntity with Microsoft.Xrm.Client.Entity
  • In aspx page files replace the following  Import directive <%@ Import Namespace="Adxstudio.Microsoft.Crm"%> with <%@ Import Namespace="Microsoft.Xrm.Client"%>
  • In aspx page files replace the following Import directive <%@ Import Namespace="Adxstudio.Xrm.Web"%> with <%@ Import Namespace="Microsoft.Xrm.Portal.Web"%>
  • In aspx page files replace the following Import directive <%@ Import Namespace="Adxstudio.Xrm.Core"%> with <%@ Import Namespace="Microsoft.Xrm.Portal.Core"%>
  • In designer files replace Adxstudio.Xrm.Web.UI.WebControls with Microsoft.Xrm.Portal.Web.UI.WebControls (Except Adxstudio.Xrm.Web.UI.WebControls.Tags and Adxstudio.Xrm.Web.UI.WebControls.Survey)
  • Embedded file resource url has changed; Replace /xrm/images/ with /xrm-adx/samples/images (except /xrm/images/delete.png and /xrm/images/add.png)
  • SetCaseStatusAndSave method signature has changed to include a resolution subject as follows:
    • SetCaseStatusAndSave(ICrmEntity incident, string state, string resolutionSubject)
  • AddNoteAndSave method signatures have changed to include a note title as follows:
    • AddNoteAndSave(this OrganizationServiceContext context, Entity entity, string noteTitle, string noteText)
    • AddNoteAndSave(this OrganizationServiceContext context, Entity entity, string noteTitle, string noteText, HttpPostedFile file)
  • Several changes to the implementation of the WWI Conference sample site have transpired.  Please review the code provided (C:\Program Files\Adxstudio\XrmExtensions\3.0.0000\Samples\WwiConference\WwiConferenceWeb\)

Data Context Class: 

The context class generated by CrmSvcUtil has been composed using the schema names of entities, attributes and relationships.  This replaces the previous method of generating the context class with logical names and will require revising your code to reference the schema names.  The most common change to entity names is converting the first letter from lowercase to uppercase. For example the entity Web Site’s logical name is adx_website and its schema name is Adx_website.   A majority of attribute names are expressed in CamelCase, although there may be a few exceptions.  For example the Web Site’s primary key logical name is adx_websiteid and its schema name is Adx_WebsiteId.  The collection of entities was previously accessed by referring to the entity logical name pluralized, now the schema name is expressed using uppercase on the first letter of the entity and appending the word Set.  For example, getting the collection of Web Sites is now done by calling context.Adx_websiteSet.

The code generated by Crm Service Utility you placed in your context class project will contain all the schema names.  You can also refer to the metadata by viewing the data service from CRM in a web browser. Example:http://crmservername/yourorganizationname/xrmservices/2011/organizationdata.svc/$metadata (replace crmservername with the name of your crm server, and replace yourorganizationname with the name of your crm organization instance)

In your page template files, code behind files and class files you will need to revise the code to reference schema names.

In.aspx page template files containing crm:Property controls you will need to replace the PropertyName values with the corresponding schema names.  Example: <crm:Property DataSourceID="CurrentEntity" PropertyName="adx_copy" CssClass="copy" EditType="html" runat="server" /> now becomes <crm:Property DataSourceID="CurrentEntity" PropertyName="Adx_Copy" CssClass="copy" EditType="html" runat="server" />

DataContext and CoreDataContext has been depreciated in favor of ServiceContext

Example how to create a context:

var context = (XrmServiceContext)CrmConfigurationManager.CreateContext();

SiteDataContext has been made obsolete. Please use Adxstudio.Xrm.Cms.OrganizationServiceContextExtensions

MembershipDataContext has been made obsolete. Please use Adxstudio.Xrm.Memberships.OrganizationServiceContextExtensions

ForumDataContext has been made obsolete. Please use Adxstudio.Xrm.Forums.OrganizationServiceContextExtensions

EventsDataContext has been made Obsolete. Please use Adxstudio.Xrm.Events.OrganizationServiceContextExtensions

CommerceDataContext has been made Obsolete. Please use Adxstudio.Xrm.Commerce.OrganizationServiceContextExtensions

XrmCmsDataServiceDataContext has been replaced with XrmCmsDataServiceContext.  For an example of a custom data service please refer to Data.svc (C:\Program Files\Adxstudio\XrmExtensions\4.0.0000\Samples\WWI Conference\WwiConferenceWeb\Feeds\Data.svc)

ICrmEntity has been depreciated in favor of Entity provided by the Microsoft.Xrm.Sdk library.

SiteContext has been made obsolete and replaced by IPortalContext

//Getting the portal context var portal = PortalCrmConfigurationManager.CreatePortalContext(); //Getting the current website var website = (Adx_website)portal.Website; //Getting the current entity: var entity = portal.Entity; //Getting the current user contact: var contact = portal.User;

Entity Extension methods have been scoped to the Organization Service Context.

//Retrieving a Web Page from a Site Marker name: var portal = PortalCrmConfigurationManager.CreatePortalContext(); var page = (Adx_webpage)portal.ServiceContext.GetPageBySiteMarkerName(portal.Website, "Home"); //GetUrl method example retrieving a URL for a given entity: var url = context.GetUrl(entity);

Lookup type attribute values can no longer be assigned Guids and now must be assigned an EntityReference.  For example:

var contact = context.ContactSet.FirstOrDefault(c => c.FullName == "Bill Gates"); page.Adx_AuthorId = contact.ToEntityReference();

Example setting an Activity Party:

var contact = context.ContactSet.FirstOrDefault(c => c.FullName == "Wayne Gretzky"); var task = new Task { Subject = “Send Meeting Invitation”, Description = “Send email to invite Wayne to discuss moving the team back to Winnipeg”, task_activity_parties = new [] { new ActivityParty { PartyId = contact.ToEntityReference() } } }; 

GetRelatedEntities and GetRelatedEntity methods replace dot through relationships.  For example:

var pages = website.adx_website_webpage;

is now achieved by doing the following...

var pages = website.GetRelatedEntities(context, w => w.adx_website_webpage);

Inline Editing Changes

In your master page:

replace <asp:ScriptManager runat="server"/> with

<asp:ScriptManager runat="server">    <Scripts></p>       <asp:ScriptReference Path="" />    </Scripts> </asp:ScriptManager> 

Remove script tags (such as <script src="/js/jquery.autocomplete.min.js"></script> ) and add them to the ScriptManager as ScriptReferences.

<asp:ScriptManager runat="server">    <Scripts>       <asp:ScriptReference Path="" />       <asp:ScriptReference Path="/js/jquery.autocomplete.min.js" />    </Scripts> </asp:ScriptManager>

Replace <crm:SiteEditingManager runat="server" /> with

<crm:SiteEditingManager runat="server"> <%-- These scripts and styles are required for XRM inline editing support. CDN-based versions are included here for convenience, but they can also be downloaded and hosted locally if desired. --%> <DependencyScripts> <asp:ScriptReference Path="" /> <asp:ScriptReference Path="" /> <asp:ScriptReference Path="" /> <%-- Add a ScriptReference for TinyMCE ( here to enable rich HTML editing. (Framework designed for TinyMCE 3.2-3.3.) --%> <asp:ScriptReference Path="/xrm-adx/js/tiny_mce/tiny_mce.js" /> </DependencyScripts> <DependencyStyles> <crm:StyleReference Path="" /> </DependencyStyles> </crm:SiteEditingManager> 

Add the following to your master page

<crm:CrmEntityEditingManager DataSourceID="CurrentEntity" runat="server" />

Remove the following code from your master page code file:

private static readonly List<string> ScriptIncludes = new List<string>{"~/xrm/js/jquery/jquery-1.3.2.min.js",}; 

Remove the following code from the Page_Load method:

foreach (var path in ScriptIncludes) { var absolutePath = VirtualPathUtility.ToAbsolute(path); ScriptManager.RegisterClientScriptInclude(this, Page.GetType(), absolutePath, absolutePath);} 

In NewForumPost.ascx.cs and PageCommentCreator.ascx.cs files:

Remove the following code:

private static readonly List<string> ScriptIncludes = new List<string>{"~/xrm/js/tiny_mce/3/tiny_mce.js","~/js/tiny_mce_init.js",};

From the Page_Load method remove the following code:

foreach (var path in ScriptIncludes) { var absolutePath = VirtualPathUtility.ToAbsolute(path); ScriptManager.RegisterClientScriptInclude(this, Page.GetType(), absolutePath, absolutePath);}

Add a ScriptManagerProxy control as follows:

<asp:ScriptManagerProxy runat="server"> <Scripts> <asp:ScriptReference Path="/xrm-adx/js/tiny_mce/tiny_mce.js" /> <asp:ScriptReference Path="/js/tiny_mce_init.js" /> </Scripts> </asp:ScriptManagerProxy> 

Clean and Build your Solution

Please refer to the code found in the sample website projects provided with the install.  Source code can be located in C:\Program Files\Adxstudio\XrmExtensions\4.0.0000\Samples\