?
Solved

BC30002: Type 'CrmService' is not defined

Posted on 2009-02-23
10
Medium Priority
?
1,260 Views
Last Modified: 2013-11-24
I've developed a web page (aspx) with some code to create some records in a Microsoft CRM 4.0 system using the CrmSdk Webservice located on our CRM 4.0 server.
The Web page is completely functional on my development PC. However referencing this webpage after copying it to the <<CRMSystem>>/ISV/MyCompany/MyApp folder it not longer functions. It displays the error, BC30002: Type 'CrmService' is not defined. Looking at the CRM 4.0 system's Web.Config file I can see that there is a reference to the Microsoft.Crm.Sdk assembly. Obviously there is still something missing that I've not done. This is my first Web App so not sure were I'm going wrong so please help?
0
Comment
Question by:Jacques_Pretorius
  • 5
  • 4
10 Comments
 
LVL 10

Expert Comment

by:crm_info
ID: 23710611
Here are a few links that may have information to solve your problem.  My guess is that you've not properly registered the web service with your application.
http://social.microsoft.com/forums/en-US/crmdevelopment/thread/db923b19-c4af-4eaa-811a-88fbed22a05b/
http://social.microsoft.com/forums/en-US/crmdevelopment/thread/564eff88-4810-433c-8cdc-21a2e044882c/
http://social.microsoft.com/forums/en-US/crmdevelopment/thread/1de371d6-85a9-4910-be95-56ddf7e80794/
Of course I am assuming that you have consulted the CRM SDK - there are some excellent examples in there.  If you've not downloaded it yet, then you can find it here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=82E632A7-FAF9-41E0-8EC1-A2662AAE9DFB&displaylang=en
 
0
 
LVL 11

Expert Comment

by:rakeshAgarwal
ID: 23710775
Hi

1. Have you published the site
2. Have you copy pasted the whole folder containing the site ( then delete all files except the .cs and .aspx file)
3. Please post the detail error message

Regards
Rakesh Agarwal
www.dynamicsexchange.com
0
 

Author Comment

by:Jacques_Pretorius
ID: 23710967
Hi Rakesh,
1. I've copied the whole Site and removed the Web.Config file. No other files were removed. (I've also have a datepicker and image files with this site. Which files should be rempved?

2. I have not published the site because its located in our CRM systems ISV folder and referencing it hopefully through http://crmsystem:5555/isv/mycompany/myapp/mypage.aspx. Do I still need to publish?

3. Error message code below...and attached the function it's refering to

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'CrmSdk.CrmService' is not defined.
Source Error:
Line 45:     Private Sub ProcessTaggedBillableTasks(ByVal organizationName As String)
Line 46:         Try
Line 47:             Dim crmService As CrmSdk.CrmService = GetCrmService(_organizationName) ' service required for any communication to the crm database
Line 48:             Dim userRequest As New WhoAmIRequest() ' find out who the user is
Line 49:             Dim user As WhoAmIResponse = DirectCast(crmService.Execute(userRequest), WhoAmIResponse)
Source File: C:\Program Files\Microsoft Dynamics CRM\CRMWeb\isv\mycompany\company_billing\CreateBillableItems.aspx.vb    Line: 47

Private Function GetCrmService(ByVal organizationName As String) As CrmSdk.CrmService
        ' Setup the Authentication Token 
        Dim token As CrmAuthenticationToken = New CrmAuthenticationToken()
        Dim crmService As New CrmSdk.CrmService()
        Dim orgInfo As OrganizationDetail = GetOrganizations(organizationName)
 
        token.OrganizationName = organizationName
        crmService.Url = orgInfo.CrmServiceUrl
        crmService.Credentials = System.Net.CredentialCache.DefaultCredentials
        crmService.CrmAuthenticationTokenValue = token
 
        Return crmService
    End Function

Open in new window

0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
LVL 11

Expert Comment

by:rakeshAgarwal
ID: 23711126
1. create a folder mycompany
2. Go to my company folder
3. Create a folder my app
4. Go to my app folder
5. keep only .aspx file and .cs  files
go to
C:\Program Files\Microsoft CRM\CRMWeb\bin
locate Microsoft.Crm.WebServices.dll

Go to start---> run --> assembly
It will open up a folder
Drag and drop the above assemble "Microsoft.Crm.WebServices.dll"




Regards
Rakesh Agarwal
0
 

Author Comment

by:Jacques_Pretorius
ID: 23711604
Hi Rakesh,
I've removed all folders and files and left only the .aspx and .aspx.vb files and an _Image folder.
Ive dragged and dropped the webservices.dll file into the assembly folder. I've restarted iis to ensure I'm not working with cached pages. Unfortunately I still have exectly the same problem.
Is there anything else you think I should do?
Thanks,
JP.
0
 

Author Comment

by:Jacques_Pretorius
ID: 23712949
Where should I go from here?
0
 
LVL 11

Expert Comment

by:rakeshAgarwal
ID: 23713320
Dim crmService As New CrmSdk.CrmService()
Dim crmService As New CrmService()

just do this and check it out

Private Function GetCrmService(ByVal organizationName As String) As CrmSdk.CrmService

Private Function GetCrmService(ByVal organizationName As String) As CrmService

Hope this helps
0
 

Author Comment

by:Jacques_Pretorius
ID: 23713727
I get the error BC30002: Type 'CrmSdk.CrmService' is not defined on the line...
Dim crmService As New CrmSdk.CrmService()
 and
I get the error BC30002: Type 'CrmService' is not defined on the line...
Dim crmService As New CrmService()
0
 
LVL 11

Accepted Solution

by:
rakeshAgarwal earned 2000 total points
ID: 23720047
This is wiered.

Why dont you do this
1. Publish the site to folder ( in VS  right click project file and say publish)
2. Copy the folder and place in ISV folder

0
 

Author Closing Comment

by:Jacques_Pretorius
ID: 31550057
Rakesh, Thank you for all your help that worked for me.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will learn how to count occurrences of each item in an array.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question