My application has a mixture of 3.5 and 4.0-targeted assemblies. I\'m working on a new Windows service targeting 4.0 and the project suddenly seems unable to see some of th
I was adding projects to a Solution that utilized .net 4.5. The projects I had added were defaulting to 4.5.1. This rendered 4.5 libraries incompatible with the new projects. I went into the properties of my new projects and had them target 4.5 instead of the default 4.5.1. After I had done that, my solution was able to build.
This problem happened to me once I solved it by deleting all the using statements on top and manually writing them again.
I had a similar issue, an assembly reference fail (“Are you missing a using directive or an assembly reference?”) and the VS intellisense gave me the opportunity to add the using but in the solution the reference had the yellow icon and the build was failing.
I solved this looking at the project property Target Framework and changing the .net version to the reference solution version and this solved all problems.
Note: The .net versions should be compatible between projects.
Please also note it can happen if you change the namespace but you did not changed the Assembly name in the project properties.
Check the target platform of the new project and make sure it's not targeting .NET 4 Client Profile. If it is, change it to regular .NET 4
Are the dependencies set correctly in the solution? I have seen more than one occasion where Project A depends on Project B, but because the dependency between the two was not set the build fails sporadically.
The underlying cause in this case is that the build is order is not deterministic and success/failure depends on things like which projects build (based on what changed) and which builds first (when more than one builds).