Saturday, September 15, 2012

Crm 2011 Developer Toolkit - Findings

I've started using the CRM 2011 Developer Toolkit from the SDK, and I have to say I'm pretty happy with it in general - although it does have some small issues.

The Developer Toolkit takes care of a lot of common development tasks all within Visual Studio, including:

- Code Generation of Entities (similar to CrmSvcUtil.exe)
- Code Generation of Plugin templates
- Entity Registration with CRM
- Web Resource Management
- Deployment of Web Resources, Plugins, Workflows etc..

Here's some of the small issues I've found with the tool - none that I've found to be show stoppers.

Error registering plugins and/or workflows. The resource string "ErrorSerializingRegFile" for the "RegisterPlugin" task cannot be found. Confirm that the resource name "ErrorSerializingRegFile" is correctly spelled, and the resource exists in the task's assembly. C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets 176 4 CrmPackage

For whatever reason, the "RegisterFile.crmregister" file in the CrmPackage Project needs to be editable, so if you have it source controlled with TFS or it's read only for some reason - you'll get this message.  Just simply check the file out or make the file writable.

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

When generating the entities, you might get the above message.  This is because of a bug which doesn't get on very well with Solution Folders in your solution.  To work-around, simply remove the solution folders from you solution.

The Context Class is missing when you generate the entities

For some reason, the context class is not generated when you generate the LINQ entities as it is in CrmSvcUtil.  Luckily, this is not required to use the LINQ functionality - but you'll need to make a few small changes
- Instead of creating a new context, you'll need to create a OrganizationServiceContext instead
- When you query against the OrganizationServiceContext, you'll need to use the CreateQuery<Entity>() syntax instead of the CrmContext.EntitySet syntax in your LINQ Queries

TIP: I'm just working on Javascript, and every time I deploy it deploys the plugins as well, how do I just deploy the Web Resources?

If you want to deploy the web resources but avoid deploying any workflow and plugins (because of the amount of time to register these things), simply change the CrmPackage "RegisterFile.crmregister" file's Build Action from "Register Plugin" to "None".  The Build Action option can be found in the Visual Studio properties for the file.  This will stop workflows and plugins from registering and save a lot of time when your just working on web resources.   If you want to enable registering of plugins & workflows again - simply do the reverse.

No comments: