1

I have a C# MVC web app in VS2017 that references two library projects, Crd.Core and Crd.Data. These two libraries both reference the same third party dlls that I've got stored in a folder at the solution level. In Debug everything builds OK. In Release Crd.Core builds OK but Crd.Data fails with two errors:

Unable to generate a temporary class (result=1).    

CS0012 The type 'Consilium.TASKMobile.Common.Messages.UserType' is defined in an assembly that is not referenced. You must add a reference to assembly 'Consilium.TASKMobile.Common.Messages, Version=6.0.60037.0, Culture=neutral, PublicKeyToken=null'.

This assembly is definitely referenced. The exact same file is referenced by both projects from the same neutral location. I have tried moving the referenced files, and removing the references before re-adding them again.

The following are the identical for both projects:

  • configurations (Any CPU)
  • target framework (4.6.1)
  • PropertyGroups in the csproj file
  • References to the thirds party DLLs in the csproj file
  • Properties of the references (same versions, Copy Local = True, etc)

Basically my two projects are identical in every way that I can think of checking but one of them fails to build in Release mode so there must be something different somewhere. What am I missing? What else can I check?

Phil Jones
  • 86
  • 5
  • Please try to make sure you have added the reference to “Consilium.TASKMobile.Common.Messages” dll(version:6.0.60037.0). And maybe you can get help from these two links: [compiler error CS0012](https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/x0dz51e1(v=vs.90)) and [Build error](https://stackoverflow.com/questions/22822406/build-error-you-must-add-a-reference-to-system-runtime) – LoLance Jan 28 '19 at 02:48
  • Thanks Lance, that dll is definitely referenced (otherwise it wouldn’t build in debug) and it’s definitely referenced in exactly the same way as my second project which compiles in both debug and release. I can’t find anything in either of those links that apply or help. – Phil Jones Jan 29 '19 at 16:41

1 Answers1

0

So I spent quite a bit of time on this and got precisely nowhere so thought I'd take a break and come back to it. Two weeks later I'm preparing to deploy a Release build for my first user testing and lo, no errors!

Apologies to anyone who ends up here looking for a solution - I have no idea what caused it or why the issue went away, suffice to say that neither the dlls or my references to them have changed.

Phil Jones
  • 86
  • 5