1

I'm trying to track down a build problem in VS 2013 and an ASP.NET MVC project.

The build fails, but the only meaning full looking message is an assembly conflict warning.

I fixed it enough for the specific error telling me which assembly in diagnostic mode went away

When I do a full rebuild, everything builds but my main project tacadmin which fails

10>------ Rebuild All started: Project: TACAdmin, Configuration: Debug Any CPU ------ 10>Build started 6/2/2023 12:03:54 PM. 10>CoreClean:

10>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. 10>D:\TFS\TACAdmin_3_19\TACAdmin\RDLC\ExampleOfRDLC.rdlc : warning rsOverlappingReportItems: The line ‘line1’ and the text box ‘textbox6’ overlap. Overlapping report items are not supported in all renderers. 10>D:\TFS\TACAdmin_3_19\TACAdmin\RDLC\ExampleOfRDLC.rdlc : warning rsOverlappingReportItems: The line ‘line1’ and the text box ‘textbox5’ overlap. Overlapping report items are not supported in all renderers. 10>D:\TFS\TACAdmin_3_19\TACAdmin\RDLC\OMS20RptTotals.rdlc : warning rsOverlappingReportItems: The text box ‘textbox1’ and the text box ‘textbox16’ overlap. Overlapping report items are not supported in all renderers. 10> 10>Build FAILED. 10> 10>Time Elapsed 00:00:05.16 ========== Rebuild All: 9 succeeded, 1 failed, 0 skipped ==========

Which is weird as the only meaningful message is a warning about conflicts of the same assembly. I turned msbuild output to diagnostic, and had a message about a conflict between system.web.mvc 3 and 5.2.3.

So I added the mapping in the config to fix that.

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>

Still got the error. I installed the nuget package for System.Web.Mvc 5.2.3.0 in all the projects with a reference to System.Web.Mvc.

Still got the error. So installed it in every single project in the solution.

The specific message about System.Web.Mvc 3 and 5 disappeared but I'm still getting the failed build error and the assembly mismatch warning above.

The logs are super long in diagnostic mode, but when I search for conflict, error and exception I find nothing.

I searched the solution folders for System.Web.Mvc and track down references in the reference cache files.

enter image description here

I run the dependency checker in VS2013, and it only shows the references to System.Web.Mvc 5.2.3.0.

The cache files still shows mvc 3.

I used the dependency diagram in VS 2013 under architecture, and it only shows a dependency on System.Web.Mvc 5.2.3.0.

enter image description here

(can't get a screenshot of the info popup because of work settings, but it's System.Web.Mvc 5.2.3.0

I'm at a loss.

How do I :

  1. Figure out if that warning is really why the build is failing.
  2. Figure out for sure what assembly conflict their is, if its not as I assume still System.Web.Mvc 3.
  3. Trace the dependencies tree to the very ends to see if any of my referenced dlls in those projects are themselves depending on System.Web.Mvc 3, and that's the issue. (dependency of a dependency)
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Eric Brown - Cal
  • 14,135
  • 12
  • 58
  • 97
  • 1
    Just checking, have you deleted the bin and obj folders and done a true "rebuilt" – Richard Housham Jun 08 '23 at 08:51
  • 1
    Have you looked at this. https://stackoverflow.com/questions/24772053/found-conflicts-between-different-versions-of-the-same-dependent-assembly-that-c – Richard Housham Jun 08 '23 at 08:54
  • 1
    I guess an alternative would be to backup the code, delete the project - recreate with all the code and fix any dependancies. Bit long but there you go... – Richard Housham Jun 08 '23 at 09:01
  • Richard Housham - That was my backup plan if I couldn't' figure it out. I didn't' manually delete the bin folders, but I did do a clean, and then a manual rebuild all. Thanks for the SO post reference – Eric Brown - Cal Jun 09 '23 at 14:18

1 Answers1

1

I'm putting this answer here in hopes it helps the next person that has this issue, even my solution is a bit ambiguous. I didn't find a line in a csproj or packages.config that gave me an aha moment. I brute forced the problem.

I had this Error Several times, for several assemblies... but System.Web.Mvc was the only one that after I manually patched everything, it still said it was bad. I never did figure out why a warning about ambiguous references made a build fail, but this was 100% what was happening. when all of the assembly conflict warnings were fixed it compiled.

I went into tool->options-> build and run and set both the output and the logging to diagnostic. This helped with the later re-occurrences.

I used Ndepends, which will not scan a project from vs2013(2015 was the oldest supported), so I thought wouldn't help me. Later I realized I was able to get it to scan a folder instead, just pointing to the bin/Debug folder got me the dependency tree. It showed the same thing, all the packages were correctly depending on the v5 of System.Web.MVC. not the v3.

I eventually fixed this by manually running uninstall-package System.web.mvc -force on every package in the solution one at a time. Verifying that they all were gone, and then reinstalling the package (Our libraries package) that has the dependency to System.web.MVC in it's nuspec file. That fixed it, even though it shouldn't have been that different from installing it by hand.

The other occurrences of the same error, one I fixed as above, and another I fixed by uninstalling the package then just building and letting package refresh pull the new version down... That surprised me as I'd removed the package reference from all the packages.config in theory, but it worked.

The last occasion I updated the config alone as above and fixed the issue. In that last the problem was that a package I depended upon, but could not change was referencing an older version. Not sure why this one worked when others didn't.

As Richard's comment above said, my answer of last resort was to make a fresh solution, and move the packages over one at a time by hand, and then re-fix all the references again. I've had this fix baffling reference errors that made no sense in the past many times.

A bit messy, but so was the problem itself. I hope this answer helps the next person who encounters the error.

Eric Brown - Cal
  • 14,135
  • 12
  • 58
  • 97