15

I have a big solution with 30 projects of which 2 are web projects (MVC and WebAPI) with a bunch of background class library projects.

I have visual studio set up to host the web projects in IIS.

If I do a clean build, followed by a full build of the entire solution, then accessing both projects via a browser works fine. (they are in diff folders and hosted on diff 'domains' in iis)

If I make NO code changes, simply rebuild one of the 2 web projects, the OTHER one stops working.

To be clear, rebuilding the WebAPI project causes the MVC project to have errors. And vice versa.

The error I get is saying that System.Web.Http.Formatter is not found. The detail says that the located assembly version is different from the reference version. Checking the bin folder shows that that is not the case.

user230910
  • 2,353
  • 2
  • 28
  • 50
  • Can you give us exact error in detail. Also If VS says those reference has different version you can be sure it is. Are you hosting those web api and mvc app in the same site in IIS?. – efaruk Jan 24 '16 at 21:34
  • 1
    I had similar problems about MVC 3.0.0.0 and 3.0.0.1 version conflicts, maybe it's related? – Ramazan Binarbasi Jan 26 '16 at 00:45
  • To start with, what version of MVC are you using? What other packages do your projects depend on? – Eniola Jan 29 '16 at 21:06

2 Answers2

8

Make sure that all the solution's resources are up to date. If you use Nuget, update all packages in all projects (back up first!). It sounds like you have a version mismatch, where functionality is missing in DLLs copied to the output directory for the solution. It may involve changing some entries in the Web.config of each project, but without access to the code, it's hard to know for sure.

Report back once you've updated every library, and made sure the versions match across all projects in the solution.

Apache
  • 619
  • 6
  • 22
  • 1
    Thank you for the response, I am away from the pc at the moment, will do this tomorrow morning and give feedback. – user230910 Jan 24 '16 at 13:57
  • 1
    One other thing, make sure you check your build order. If your MVC and WebAPI projects are referenced to each other, you'll need to build the dependent project first in the build order. It should be set automatically, but in such a large solution, things can go awry. Consider breaking down your solution into smaller chunks to increase performance. Your output folder must get very clogged. – Apache Jan 24 '16 at 17:26
  • Additionally, if you are using NuGet, make sure the installed versions of the packages you're using are the same for both projects. – Steve Jan 25 '16 at 04:32
  • 1
    ok, this was it, nuget version conflicts on one of the dependant libraries (not in the actual mvc or webapi projects) – user230910 Jan 26 '16 at 06:25
4

In addition to Apache's and Steve's suggestions, I'd also recommend deleting the files in your Temporary ASP.NET Files directory. If you're curious here's a good write-up of what the contents of that folder are for.

Community
  • 1
  • 1
Jerreck
  • 2,930
  • 3
  • 24
  • 42
  • 1
    Thanks, this was one of the things i tried myself before asking for help, its a good suggestion for future googlers – user230910 Jan 26 '16 at 06:25