Search code examples
c#dllvisual-studio-2019mscorlib

warning MSB3258 on mscorlib for shared reference


So I am currently working on a .NET Framework project that is referencing a DLL made by another dev I am working with that I will call "random.dll". My project is targeting .NET 3.5. I have no compiler errors in my project but when I attempt to build while referencing this DLL I receive a warning during the build saying the reference could not be resolved:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3258: The primary reference "random.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

This build warning causes my build to fail when attempting to reference classes in that reference.

I then zipped up my project and sent it to the dev who was able to build it themselves with no changes to the project. I am trying to figure out what could possibly be different on only my machine that would cause this issue.


Solution

  • Change your .net framework to 4.0.0