crm -2147220970 errorcode SOLVED

La semana pasada tuve que ayudar a unos amigos a resolver el error CRM -2147220970. Después de batallar durante horas, encontramos la solución:

Buscamos muchas soluciones, y la que nos funcionó al final del día fue decirle a ILMerge dónde encontrar mscorelib:

.\Tools\ilmerge.exe /t:library /internalize /targetplatform:"v4,$env:windir\Microsoft.NET\Framework$bitness\v4.0.30319" /wildcards /out:$baseDir\RequestReduce\Nuget\Lib\net40\RequestReduce.dll "$baseDir\RequestReduce\bin\v4.0\$configuration\RequestReduce.dll" "$baseDir\RequestReduce\bin\v4.0\$configuration\AjaxMin.dll" "$baseDir\RequestReduce\bin\v4.0\$configuration\StructureMap.dll" "$baseDir\RequestReduce\bin\v4.0\$configuration\nquant.core.dll"

Mat Wrock tiene una explicación MUY exhaustiva que si realmente tienes tiempo de leerla por completo te la recomendamos, y el equipo de MSBuild habla más de esta carpeta aquí here.


Muchas otras personas les funcionó una descarga que parcha el servidor que no fue configurado para usa licencias VS — VS Licenses. Puedes descargar los paquetes correctos aquí . Muchas otras personas mencionaron que su problema en realidad se resolvió

  Yes, this technically can go wrong when you execute code on .NET 4.0 instead of .NET 4.5. The attribute was moved from System.Core.dll to mscorlib.dll in .NET 4.5. While that sounds like a rather nasty breaking change in a framework version that is supposed to be 100% compatible, a [TypeForwardedTo] attribute is supposed to make this difference unobservable.

As Murphy would have it, every well intended change like this has at least one failure mode that nobody thought of. This appears to go wrong when ILMerge was used to merge several assemblies into one and that tool was used incorrectly. A good feedback article that describes this breakage is here. It links to a blog post that describes the mistake. It is rather a long article, but if I interpret it correctly then the wrong ILMerge command line option causes this problem:


Which is incorrect. When you install 4.5 on the machine that builds the program then the assemblies in that directory are updated from 4.0 to 4.5 and are no longer suitable to target 4.0. Those assemblies really shouldn’t be there anymore but were kept for compat reasons. Unfortunately the C++/CLI #using directive still depends on those assemblies, hard to fix. The proper reference assemblies are the 4.0 reference assemblies, stored elsewhere:

  /targetplatform:"v4,C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"

So possible workarounds are to fall back to 4.0 on the build machine, install .NET 4.5 on the target machine and the ultimate fix, to rebuild the project from the provided source code, fixing the ILMerge command.

Do note that this failure mode isn’t exclusive to ILMerge, it is just a very common case. Any other scenario where these 4.5 assemblies are used as reference assemblies in a project that targets 4.0 is liable to fail the same way. Judging from other questions, another common failure mode is in build servers that were setup without using a valid VS license. And overlooking that the multi-targeting packs are a free download.

Using the reference assemblies in the c:\program files subdirectory is a rock hard requirement. Starting at .NET 4.0, already important to avoid accidentally taking a dependency on a class or method that was added in the 4.01, 4.02 and 4.03 releases. But absolutely essential now that 4.5 is released.

Leave a reply:

Your email address will not be published.

Únete a nuestra lista

Suscríbase a nuestra lista de correo y obtenga cosas interesantes y actualizaciones a su bandeja de entrada de correo electrónico.

Gracias por suscribirse.

Algo salió mal.