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