Strong Name Validation Failed on CRM 2016 GeneratePicklistEnums

0

I am starting a new project on a new Windows 10 computer working on CRM 2016 and have some strange behavior. I needed to generate the enumerations of the picklists for my code so I used the GeneratePicklistEnums project from the 2016 SDK SampleCode folder. I created the signing certificate on the project properties, ran build, and modified the .bat file (as I have done with past versions) and when I run the batch file I get this error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A) --- End of inner exception stack trace --- at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)

I read a bunch of blogs and MS community posts on turning off strong name checking and adding exceptions - none of them worked.

I looked at the AssemblyInfo.cs and didn't see any reference to the AssemblyKeyFile so I added one - didn't make a difference. I tried several things with sn.exe, including "sn -Vr *" but that didn't work either. I used ildasm to inspect the GeneratePicklistEnums.dll and it showed as version 0.0.0.0 and all the referenced assemblies did have version numbers.

Any suggestions?

--- update: I finally got the code to run by going back to the SDK and copying the following files from that BIN folder into my project BIN folder:

Microsoft.Xrm.Tooling.Connector
Microsoft.IdentityModel.Clients.ActiveDirectory
Microsoft.Xrm.Tooling.CrmConnectControl
Microsoft.Crm.Sdk.Proxy
Microsoft.Xrm.Sdk

but it still is not getting a version or strong name.

c#
sdk
dynamics-crm
asked on Stack Overflow Jun 6, 2016 by Eccountable • edited Jun 7, 2016 by Eccountable

2 Answers

0

The CRM SDK Toolkit has 2 different folders with CrmSvcUtil.exe. If you use the one under \SampleCode\CS\CrmSvcUtilExtensions\GeneratePicklistEnums\bin\Debug, you will get the error message. However, if you use the one under \bin, it will work.

Just ensure that in your command or batch file, you use the absolute path to the [CRMSDK]\bin\CrmSvcUtil.exe

answered on Stack Overflow Jul 2, 2019 by Davatar
-1

There is an open source tool for the XrmToolbox called the Early Bound Generator from Daryl LaBar, which is just a wrapper on top of crmsvcutil from the SDK. Save yourself the trouble and use that tool, it has a lot of nice features baked in. Btw, with the latest versions of the toolbox, there is a plugin "store" so you don't even have to download the EBG manually anymore.

answered on Stack Overflow Jun 6, 2016 by Polshgiant

User contributions licensed under CC BY-SA 3.0