Can Poyrazoğlu
Can Poyrazoğlu

Reputation: 34780

Randomly occuring: Could not load file or assembly 'System.Reflection' or one of its dependencies

I am working on an ASP.NET (.NET 4.7) project and I'm constantly getting the following error when I change completely irrelevant part of my app:

Could not load file or assembly 'System.Reflection' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

If I uninstall System.Reflection and reinstall it (using NuGet) the problem goes away... only for a few minutes. I change something else in code (nothing to do with Reflection or no NuGet package adding/removing, just some C# or HTML code), restart my app, and the error comes again.

Why is it happening randomly and how do I get rid of this?

UPDATE: I've deleted all the bin and obj folders from the whole solution countless of times. No avail.

Upvotes: 2

Views: 493

Answers (2)

juFo
juFo

Reputation: 18567

Had the same issue. Change 4.7 to 4.7.1 and it is fixed.

Upvotes: 1

gilmishal
gilmishal

Reputation: 1992

I had a similar issue - in my case it was a problem with nuget restoring to packages from older .net versions which I was unable to solve. Ended up upgrading to the new VS 2017 csproj format and therefore the new nuget, and it solved my issue.

Upvotes: 1

Related Questions