Website project targeted to .NET 4.0 is picking up stuff from newer .NET versions

43 Views Asked by At

I have a ASP.NET WebSite project in my solution, there are other class library projects that are all targeted to .NET 4.0. It works fine on every developer's computer except for one.

Linq in .NET 4.0 did not have a Prepend extension method so we had created one ourselves, on one developer's computer the website crashes with a runtime error stating that the Prepend is ambigous between our namespace and Linq's namespace.

Prepend was first introduced in .NET 4.7.1 which we are not targeting. We checked the bin directory, System.Core.dll is 4.0. We checked all other DLLs' manifests to make sure they are dependent on System.Core 4.0.

What else do we need to check?

1

There are 1 best solutions below

0
On

ASP.NET applications are compiled against directly against the files in the .NET Framework folder (i.e directly against the implementation). Since .NET Framework is an in-place update, newer versions of the Framework will overwrite the files already in the same folder.

One thing you could do is call your Prepend method directly (ie. fully qualified name) and not like an extension method.