Web deploy publishes wrong version of assembly
Asked Answered
S

1

9

I have a Web API project that has a dependency on System.Web.Http.WebHost and in my project I have set Copy Local = True on that reference, and the version (in this case) is 5.2.3.0.

When I publish the project to the server via web deploy, an older version of this assembly is published (5.2.2.x). This seems to only affect certain people when they publish and not others.

We've run into the same issue with other assemblies in other projects, so this is meant as an example. I can add the affected assembly to the server's GAC or something so it doesn't die when published by a user so affected, but I'd like to know how this happens and how it might be avoided.

Selfgoverned answered 18/9, 2015 at 16:51 Comment(2)
I'm also having this problem, except with Autofac. Is this VS 2015?Welch
@Loren Yes, though some of the devs affected are using VS 2013 too, so it doesn't seem specifically tied to ide version.Selfgoverned
W
24

In my case, I found that the wrong version of Autofac was being deployed, even though the correct version was referenced and was placed into the bin folder while running locally. I re-installed the NuGet package and even that didn't work.

Ultimately, I found the obj\Release\Package\PackageTmp\bin directory (within the project directory) contained the outdated version, and nothing I did would cause it to update. Simply deleting the directory and letting it regenerate solved the issue.

Welch answered 19/10, 2015 at 20:47 Comment(7)
I've tried reinstalling Nuget, all packages, nothing helped. After spending 4 hours pulling my hair out I found Your answer. It solved my issue. Thank You!Rusell
I had a similar issue with System.Web.Http 5.2.2 -> 5.2.3 and in Visual Studio 2015 performing a Clean removed the PackageTmp folder from obj. We're now advising our team to perform a clean before every publish.Twohanded
This happens constantly for us. We have ended up creating pre-publish rule that will delete the bin folder from our target location before publishing. Pretty infuriating. Baffling that Microsoft struggles with crucial environment stuff like this.Corneille
LIKE OMFG M$. THANK YOU. I was going nuts because my "obj\publish" folder had the wrong stuff...Virgo
With VS 2019, .Net Core 3.1, the path is 'obj\Release\netcoreapp3.1\win-x64\R2R', win-x64 is the target platform, from my side, limited to Windows X64Mcginnis
You should get some MS reward for this answer!Paterson
And here, several years later, I had a similar problem with multiple projects after updating recommended NuGet packages from version 6.0.0 to 6.0.1. I've spent about 5 days on this. Deleted the bin and obj folder of every project involved and rebuild. Problem solved. Thank you!Thionic

© 2022 - 2024 — McMap. All rights reserved.