-1

Problem: We used CRM Plugin Registration Tool to update an assembly which was working fine before. We then started to get

Could not load file or assembly "Project 1 version ....Culture.. PublicKeyToken..."

Details: The assembly project referencing another project in the same solution:

  • Project 1 (Class Library - Will be the missing file or assembly in the above message)
  • Project 2 (Assembly want to deploy) : Referencing Project 1

After digging into the problem that was causing that error by comparing a working assembly with the new assembly that was throwing the error (Using dotPeek tool to view the dlls content) we found the difference in how Project 1 existed in both assemblies.

  • Working Assembly: Project 1 source code existed in the assembly as a namespace (no dll) (Done by old developer who left)
  • Bad/Error Assembly: Project 1 existed as a reference (dll file).

Q: How can I achieve the same behavior in my code/VS as the Working Assembly?

If this help: We use Dynamics CRM 2016 On-Premise, ILMerge, Visual Studio 2015

Note:

  • We can't change from Database to Disk or GAC as tons of plugins and steps there

  • We deploy assemblies into CRM in: Non-Sandbox & Database

myth
  • 41
  • 6

2 Answers2

0

Forget about the old developer stuff. What you are doing is perfect. This is my recommendation.

Forget about the old developer stuff.

In Plugin registration tool, unregister that old assembly (where single dll is having both Project 1 & 2 under single namespace)

What you are doing is perfect.

Do an Add reference of Project 1 dll in Project 2.
Do ILMERGE & register this new assembly in PRT.
No need to change anything else.

You may have to follow my answer for a trick shot to avoid re-registering steps.

0

You need to ILMERGE to merge the different dlls you need into one and deploy that assembly into CRM.

We normally setup a post build event powershell script that merges all dlls into one directly after they are built.

Elie-M
  • 79
  • 1
  • 11