Tanguy CRM MVP creator of the excellent XrmToolbox has let the framework of the XrmToolbox the tool CRM Early Bound Generator and this is very kind and extremely useful.
here is the video review, which runs through using the file in your plugin code in visual studio.
Lets start with the basics, the tool is free and you can find the tool on codeplex
https://xrmearlyboundgenerator.codeplex.com/
The CRM Early Bound generator is basically a way to make it easier to create Early bound entities and it does this by creating an application wrapped around the CrmSvcUtil.exe.
To find out more about the CrmSvcUtil.exe click the link below
http://msdn.microsoft.com/en-us/library/gg327844.aspx
I have blogged about using the crmsvcutil in a couple of blogs
CRM 2011 – How to add crmsvcutil to the External tools menu in Visual Studio
CRM 2011 – Simple CrmSvcUtil example for creating early bound classes
So it was with some interest I cracked open this tool and the first thing you notice is the initial container is the XrmToolBox
You then have to add a connection and then you will get this page. If you have already setup the XrmToolbox you can copy the mscrmtools2011 and it will bring the connections you have already made to this tool.
Now although you can do this Early bound generator stuff with the CRM Developer toolkit he hulk2484 (excellent name), here is a picture of him
here is a picture of the tool main page
So from here you can now see you have quite a lot of options to create the early bound class. I would mention that the codeplex page has a detailed description of all the options and this tool is one of the best documentation tools I have seen, so well done with that aspect of the tool (especially consider developers had documenting things)
I noticed that clicking
Create One File Per Entity
Generates an error
Entity Path must be a directory
I guess this is a bug or maybe something I’m not changing but I’m not sure you would go for all this effort to split the files into separate files
The things I liked about the tool was this option
Entities To Skip
This will allow you to select entities to not generate CRM early bound files for, this is very useful in keeping the size of the file down and the time it takes to generate (which although small, you will have to do this lots of times). Also it remembers which records you have chosen to exlude.
Another good feature is it can create enum mappings for optionsets which makes it easier and safer to use these.
The tool is very good and easy to use. good job.
Your error that you’re getting is because you have your Entities.Relative Path set to “CrmSvcUtil Ref\Entities.cs”. If you want to generate one file per entity, you’ll need to change it to something like “CrmSvcUtil Ref\Entities”. I’ll probably change this in the tool so it does it automatically.
Also, there are two download files, “Executable with XrmToolbox” and “Dlls for use with XrmToolBox”. If you download the other file, you can just copy and paste those files into your existing XrmToolBox, and it’ll run just like Tanguy’s default plugins.
You are right that the tool is just a wrapper. It spits out the actual command line code that it uses, so if you already have some build process that generates those files, give it the new command line args, and make sure the dlls are there and it’ll work just fine.
One final thing you’re missing which is a huge value add, is the “Generate OptionSet Enum Properties” check box. It creates an extra property for every OptionSetValue, that is early bound to an Enum. So your code of
account.AccountRatingCode = new OptionSetValue(10000001);
Could be replaced with
account.AccountRatingCodeEnum = account_accountratingcode.DefaultValue;
No more magic numbers, and way easier link queries.
P.S. If you use TFS as your source control, and you have the Entities.cs and OptionSets.cs files checked in, it’ll check them out automagically. If you use Git, or don’t have the build files checked in, don’t use it…
LikeLike
Hi Daryl
Great tool thanks for making it.
The enum generator is awesome and you are right I should have shown it in my video. Maybe if I have time I might try and highlight that because it’s definitely good practice and would stop annoying syntax bugs.
LikeLike
I preformed a pretty big update to the tool to allow for actions, as well as a UI redesign that makes the settings a lot easier to understand (hopefully) I also updated the main picture of the tool on the CodePlex Page and deleted the old one, which broke your blog post, sorry 😦
Would you consider updating your video at some point in the near future?
LikeLike
It’s impressive that you are getting ideas from this piece
of writing as well as from our dialogue made at this place.
LikeLike
I want as many people as possible to benefit from my work (just as I’ve benefited from some of the of the default plugins in the XrmToolBox). This blog post is still the #1 referrer of views to the codeplex project so I keep close tabs on it 🙂
LikeLike
This has moved from Code Plex to Git Hub: https://github.com/daryllabar/DLaB.Xrm.XrmToolBoxTools/releases
LikeLike
Any updates for CRM 2016 ? https://github.com/daryllabar/DLaB.Xrm.XrmToolBoxTools ?
LikeLike
I’m in the middle of doing some updates right now…
LikeLike