none
Build errors in Customer Portal

    Pertanyaan

  • I installed CRM 2011 RTM and the customer portal. I then installed the updated code from SDK 2011 V2 published last week. I used CrmSvcUtil.exe to generate a new XRM.CS from the new deployment created with customer portal RTM installed and matched the namespace of XRM and service context name of XRMServiceContext.

    I am able to get the XRM project to build with zero errors however I get 16 errors when I attempt to build the customer service portal. Many of the errors are similar to "cannot implicitly convert type 'INT' to 'Microsoft.XRM.SDK.optionsetvalue'.

    It seems I must've missed something, any ideas?

    This looks related to article: http://social.microsoft.com/Forums/eu/crmlabs/thread/2a8e06e1-8989-4e02-acad-4bef743927e5 which suggests that the Customer Portal version 1.0 on the and  CrmSvcUtil.exe are NOT compatible.

    I can't find PortalGen to download and it does not appear to be part of the Customer Portal RTM 1.0 download. Please provide access to PortalGen f this is the issue.


    Stephen V Noe, CRM MCT
    • Diedit oleh Stephenvnoe 16 Maret 2011 17:26 additional info
    15 Maret 2011 19:55

Jawaban

  • You are missing a critical parameter in CrmSvcUtil to bring in the custom code-dom that the portal requires.  There is a file called CrmSvcUtil.cmd in the CustomerPortal folder that is set up for you to use.  Here is the command:

    $0\..\..\Microsoft.Xrm\bin\CrmSvcUtil /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm\Xrm.cs /url:http://Crm/Contoso/XRMServices/2011/Organization.svc /domain:CONTOSO /username:administrator /password:pass@word1 /namespace:Xrm /serviceContextName:XrmServiceContext /serviceContextPrefix:Xrm

    Note that you MUST use the /codeCustomization parameter.


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    • Ditandai sebagai Jawaban oleh Stephenvnoe 23 Maret 2011 18:24
    23 Maret 2011 13:55

Semua Balasan

  • As a follow up, I downloaded the ADXStudio XRM Portals code ver 4.0.0002 which does NOT have Portalgen.exe in it and ADXStudio XRM Portals code ver 4.0.0001 which does have Portalgen.exe in it. When I ran it with the current set of SDK dll, it failed. But when I ran it in the library of framework dll's that came with it all dated 1/31/2011, it created my new Xrm.cs file and the build succeeded. I was the able to build the Customer Portal without build error.

    From this I conclude that:

    1. The CRM 2011 SDK Version 5.0.2 crmsvcutil.exe in the SDK library is not compatible with Customer Portal RTM Ver 1.0

    2. the version of crmsvcutil.exe in the AdxStudio XRMPortals ver 4.0.0002 is the same as the crmsvcutl in the SDK - NOT compatible with the RTM CRM 2011 and Customer Portal ver 1.0

    3. the version of Portalgen.exe in the AdxStudio XRMPortals ver 4.0.0001 IS COMPATIBLE with the RTM CRM 2011 and Customer Portal ver 1.0

    4. There is no other version of Portalgen to be found from Microsoft download sites at this time.

    I hope this helps anyone else stuck on this bug!


    Stephen V Noe, CRM MCT
    16 Maret 2011 18:30
  • Hi Stephen,

    Portalgen.exe was released temporarily with the customer portal ctp. What version of CrmSvcUtil did you use? The latest one is dated 3/1/2011 and should be compatible with the portals. You do need Microsoft.Xrm.Client.CodeGeneration.dll from the latest SDK which is the extension library for CrmSvcUtil.

    - Palak

    17 Maret 2011 0:49
  • OK, let me research this more. First I reverified that I have the 3/1 version of the two files as specified from teh most recent SDK in the Tools directory and re-ran the command on the crm server

    OK, I spent 2 hours verifying what I spoent 8 hours researching before I wrote this reply above. Either the Portal project has 15 errors in it or you have not fixed CRMSVCUTIL.

    May I respectfully suggest that you actually test what I have now tested twice and then advise me on this. I have retested and get the same results!

    I am seeing errors in the unmodified pages in the project such as

    EditCase - 3 errors,

    • Error 164 'Microsoft.Xrm.Sdk.OptionSetValue' does not contain a definition for 'GetValueOrDefault' and no extension method 'GetValueOrDefault' accepting a first argument of type 'Microsoft.Xrm.Sdk.OptionSetValue' could be found (are you missing a using directive or an assembly reference?) H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\EditCase.aspx.cs 86 95 CustomerPortal
    • Error 165 Cannot implicitly convert type 'int' to 'Microsoft.Xrm.Sdk.OptionSetValue' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\EditCase.aspx.cs 150 36 CustomerPortal
    • Error 166 Operator '==' cannot be applied to operands of type 'Xrm.ActivityPointerState?' and 'int' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\EditCase.aspx.cs 174 64 CustomerPortal

    Event Calendar - 2 error

    • Error 11 'Microsoft.Xrm.Sdk.OptionSetValue' does not contain a definition for 'GetValueOrDefault' and no extension method 'GetValueOrDefault' accepting a first argument of type 'Microsoft.Xrm.Sdk.OptionSetValue' could be found (are you missing a using directive or an assembly reference?) H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Controls\EventCalendar.ascx.cs 33 27 CustomerPortal
    • - Error 16 'Microsoft.Xrm.Sdk.OptionSetValue' does not contain a definition for 'GetValueOrDefault' and no extension method 'GetValueOrDefault' accepting a first argument of type 'Microsoft.Xrm.Sdk.OptionSetValue' could be found (are you missing a using directive or an assembly reference?) H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Controls\EventCalendar.ascx.cs 48 27 CustomerPortal

    KBSearch

    • Error 126 Operator '==' cannot be applied to operands of type 'Xrm.KbArticleState?' and 'int' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\KbSearch.aspx.cs 39 56 CustomerPortal
    • Error 127 The best overloaded method match for 'Site.Pages.eService.KbSearch.IterateSearchTerm(System.Linq.IQueryable<Xrm.KbArticle>, string)' has some invalid arguments H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\KbSearch.aspx.cs 45 19 CustomerPortal
      Error 128 Argument 1: cannot convert from 'System.Collections.Generic.IEnumerable<Xrm.KbArticle>' to 'System.Linq.IQueryable<Xrm.KbArticle>' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\KbSearch.aspx.cs 45 37 CustomerPortal

    PortalPage.cs - err

    • Error 167 Operator '==' cannot be applied to operands of type 'int?' and 'Microsoft.Xrm.Sdk.OptionSetValue' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\PortalPage.cs 138 74 CustomerPortal

    Registration - 4 error

    • Error 129 Cannot implicitly convert type 'int' to 'Microsoft.Xrm.Sdk.OptionSetValue' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\Events\Registration.aspx.cs 132 30 CustomerPortal
    • Error 130 Cannot implicitly convert type 'int' to 'Microsoft.Xrm.Sdk.OptionSetValue' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\Events\Registration.aspx.cs 159 23 CustomerPortal
    • Error 131 Cannot implicitly convert type 'int' to 'Microsoft.Xrm.Sdk.OptionSetValue' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\Events\Registration.aspx.cs 161 26 CustomerPortal
    • Error 132 Cannot implicitly convert type 'int' to 'Microsoft.Xrm.Sdk.OptionSetValue' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\Events\Registration.aspx.cs 177 45 CustomerPortal

      ViewCases 2 error
    • Error 158 'System.Collections.Generic.IEnumerable<Xrm.Incident>' does not contain a definition for 'ToDataTable' and the best extension method overload 'Microsoft.Xrm.Portal.Data.EnumerableExtensions.ToDataTable(System.Collections.Generic.IEnumerable<Microsoft.Xrm.Sdk.Entity>, Microsoft.Xrm.Sdk.IOrganizationService, Microsoft.Xrm.Sdk.Entity, bool)' has some invalid arguments H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\ViewCases.aspx.cs 47 26 CustomerPortal
    • Error 159 Argument 2: cannot convert from 'Xrm.XrmServiceContext' to 'Microsoft.Xrm.Sdk.IOrganizationService' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\ViewCases.aspx.cs 47 54 CustomerPortal

    ViewScheduledServices - 1 error

    • Error 128 Operator '==' cannot be applied to operands of type 'Xrm.ServiceAppointmentState?' and 'int' H:\Devo\CSPortal2011MSFT\CustomerPortal\Web\Pages\eService\ViewScheduledServices.aspx.cs 29 125 CustomerPortal

     


    • Diedit oleh Stephenvnoe 18 Maret 2011 13:12 Reverifying results
    18 Maret 2011 12:30
  • What is the exact command line you used to regenerate the file?  (obfuscate your credentials, but give a true rendition of the command line otherwise).
    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    21 Maret 2011 18:22
  • crmsvcutil /url:"http://eonvapp02:5555/BITP2011/XRMServices/2011/Organization.svc" /out:"xrm.cs" /namespace:Xrm /serviceContextName:XrmServiceContext
    Stephen V Noe, CRM MCT
    22 Maret 2011 12:28
  • You are missing a critical parameter in CrmSvcUtil to bring in the custom code-dom that the portal requires.  There is a file called CrmSvcUtil.cmd in the CustomerPortal folder that is set up for you to use.  Here is the command:

    $0\..\..\Microsoft.Xrm\bin\CrmSvcUtil /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm\Xrm.cs /url:http://Crm/Contoso/XRMServices/2011/Organization.svc /domain:CONTOSO /username:administrator /password:pass@word1 /namespace:Xrm /serviceContextName:XrmServiceContext /serviceContextPrefix:Xrm

    Note that you MUST use the /codeCustomization parameter.


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    • Ditandai sebagai Jawaban oleh Stephenvnoe 23 Maret 2011 18:24
    23 Maret 2011 13:55
  • Thanks Shan! I'll give that a try. I had seen it both ways so was working to simplify.

    (Later) OK! that did the trick, I appreciate the help.


    Stephen V Noe, CRM MCT

    23 Maret 2011 14:26
  • Its because you are not only wrongly generated xrm.cs.

    But also maybe missing references in XRM project- just add them manualy and rebuild...

    Go to XRM - references and add the 3 that are corrupted : Microsoft.xrm.client, Microsoft.xrm.portal and Microsoft.xrm.sdk

    for online the right command is:

     

    CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/url:https://XXX.api.crm4.dynamics.com/XRMServices/2011/Organization.svc /out:xrm.cs /username:"name" /password:"pass /namespace:Xrm  /serviceContextName:XrmServiceContext  /serviceContextPrefix:Xrm

    26 Nopember 2011 8:28