Today I had one of those really horrible Visual Studio errors that just would not go away …
OK .. Message seemed simple enough, I’m missing a reference to the DataAccess assembly, which was breaking with a compilation error … So I check the solution to make sure WGPSN.Utility has been referenced and everything looked fine…
Reference is correct and when I compile WGPNS.Utility it’s building correctly. Weird …… ???
I went through the usual stuff like making sure that everything was building against the same version of .NET Framework (4.5) and everything was set correctly.
Solution !!
The reason for this error was nothing to do with the code but the Build Order for the solution …
Right click the solution file and select “Project Build Order”.
WGPSN.DataAccess was before WGPSN.Utility??? Why?? DataAccess references Utility and therefore the build should be Utility first then DataAccess.
Click the “Dependencies” tab and select the offending project “WGPSN.DataAccess” and it has not dependencies on “WGPWN.Utility”? That was not correct as once a project is referenced, that project should be built before the project that is using the reference.
Check the WGPSN.Utility and click “OK”.
All the problems went away.
I really don’t understand why this problem occurred as these settings are usually automatically controlled by Visual Studio, but keep your eyes out for it.