Why does build fail in Release mode?

128 views Asked by At

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?

1

There are 1 answers

0
Phil Jones On

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.