7
votes

Im trying to use the CrmSvcUtil with the following command:

C:\TMP\sdk\microsoft.xrm\tools>crmsvcutil.exe /connectionString:"Authentication Type=AD; Server=myip; User ID=myusername; Password=xxx" /generate:cs /out:schema.cs /namespace:Xmr dataContextClassName:XrmServiceContext

And this works until I Get to a line that throws a exception:

Building source code for the entity named 'subscriptionclients'...
Building source code for the entity named 'subscriptionsyncinfo'...
Building source code for the entity named 'subscriptiontrackingdeletedobject'...

Unhandled Exception: System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at CrmSvcUtil.Generator.GenerateEntityCode(XElement entityElement, String outputNamespace, DirectoryInfo outputDirectory, Boolean useLogicalNames, StreamWriter outputWriter)
   at CrmSvcUtil.Generator.Generate(IDictionary`2 arguments)
   at CrmSvcUtil.Program.Main(String[] args)

Anyone know what this means? When this exception is thrown I still have a lot of entities generated but not all of them and this makes my cs file broken

2
Can you run it under Visual Studio, catch the exception throw and figure out what it's looking for but can't find? It may be bad data you'd be able to solve, but may also be a bug. In any case might be worth opening a support ticket with Microsoft too.Rup
@Rup I attached the VS debugger. It didn't provide anything more the the exception I already had. God idé though!Marthin
Sorry about that :-( I was hoping you'd be able to see what the enumerable contains and what the predicate parameter was so you could relate this to your data.Rup

2 Answers

2
votes

Use CrmSvcUtil from the 2011 SDK (which had not been released yet when you asked this question).

2
votes

So after a few months of doing other stuff I got back to this problem and find the solution via this blog. http://blog.abodit.com/2011/03/crmsvcutil-exe-with-microsoft-dynamics-crm-2011-online-problem/