I just have set up a new asp.net mvc 4 project, using the latest .net framework (4.5) in combination with Visual studio 2012. After I added some classes, side projects etc. I suddently notice that I'm receiving 5 times the same warning when I compile the project. The warning states:
ASPNETCOMPILER : warning CS1685: The predefined type 'System.Threading.Tasks.Task' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\mscorlib.dll'
So now I'm wondering in which assemblies are this type defined than? All my projects in the solution are using version 4.5 of the .net framework, so 4.5\mscorlib.dll should be the only one or am I missing something?
My solutions consists of 4 projects ( 3 class libraries, and 1 mvc-4 web project). The 3 class libraries don't show any warnings when I compile them indepently. It's only the web project which throws the warnings, but the class library projects are referenced by the web project. The references of the web project:
Does anyone have a suggestion where to look?
Thanks in advance
BHD
UPDATE It seems that more people have similar issues like this, in my case the answer was: We are using here some company libraries, which were indeed using older versions of the framework (3.5) and caused the warnings.
Similar to article C# Compiler Warning 1685. Check if any of the referenced assemblies are themselves referencing different versions of mscorlib.dll.
Get hold of DotPeek or .NET Reflector and you should be able check what versions of assemblies the referenced assemblies are referencing.
Visual Studio output can give you the details of which assemblies are triggering this. You will need the output to be at the "Detailed"
level. Go to (in VS 2019
at least):
Tools -> Options -> Projects and Solutions -> Build and Run
and select "Detailed"
for for "MSBuild project build output verbosity"
.
Then grab the build output and look for something like "There was a conflict between..."
. That should list out the referencing assemblies, and the versions of the assembly that is in conflict. That info should be enough to decide on a course of action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With