Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Xrm.cs not working in Visual Studio 2013 aspx project

Posted on by 1,575

Hello,

I have been using a crmcvutil-generated Xrm.cs file succesfully for a lot of import jobs and taking advantage of the early-binding as a result.

I am now creating a web site project (aspx page with code behind) but when I add an existing item and bring the Xrm.cs file into the project I can't reference any crm entities by entity name - instead I have to use the late-bound syntax e.g.  Entity contact = new Entity() - and then assigning the logical name - instead of what I would expect to be able to use - " Contact contact = new Contact();" thanks to the inclusion of the Xrm.cs file (which looks normal/ fine).

It is as if my project is just taking no notice of the existence of the Xrm.cs file.

Any help would be gratefully received. Is it something to do with a namespace, the VS version, or the fact that this is an aspx project unlike the others where this was working fine?

Thanks.

 

*This post is locked for comments

  • Verified answer
    Seamus Profile Picture
    Seamus 1,575 on at
    RE: Xrm.cs not working in Visual Studio 2013 aspx project

    Sorry  - a basic error on my behalf. I had it placed outside the app_code folder - when I placed it inside this folder it was fine.

  • Seamus Profile Picture
    Seamus 1,575 on at
    RE: Xrm.cs not working in Visual Studio 2013 aspx project

    Thanks - yes of course it could be something quite basic but the class does exist - it is the same cs file that is working fine in other projects.

  • Suggested answer
    ansrikanth Profile Picture
    ansrikanth 3,115 on at
    RE: Xrm.cs not working in Visual Studio 2013 aspx project

    basic check: have you checked the namespaces ? Is the Contact class exist in the Xrm.cs you have placed ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans