Deleting everything under the project's obj folder seems to have solved this issue.
ASP.NET 5 published folder contains wrong (old) DLLs

Framework Dependent Publish setup
- Publishing to local folder
- Delete existing files set to True
- Configuration is Release
- Target Framework is net5.0
- Target Runtime is win-x64
- Project's bin folder is not included in project (could this be the issue?)
The DLLs in my project's bin/Debug/net5.0 and bin/Release/net5.0 are the proper versions, but the versions of some DLLs that end up my published folder (Microsoft.EntityFramework.Core.dll for example) are earlier (older) versions.
I had to manually copy the DLLs from my project's bin folder over to IIS.
What am I doing wrong?
1 additional answer
Sort by: Most helpful
-
Michael Taylor 41,626 Reputation points
2021-09-16T15:58:47.203+00:00 Perhaps nothing but it depends upon what you mean by "older". Are you saying that are using, say, v1.2 of an assembly in your code but when you publish it is pulling v1.1 instead? If so then most likely you have multiple projects that rely on the same assembly and one of the references is using the older version. Transient dependencies makes this even harder to figure out. In general you should be able to go to the Package Manager for the solution and the Consolidation tab should show you conflicts. Sync all projects to the same packages and you should be good.
For transient dependencies expand the
Dependencies
node in each project that might rely on the assembly in question and look at what version they are getting mapped to. Ultimately the last project built wins the copy war here.If you are instead saying that you build and publish your app and then rebuild and the publish is still copying the old files then I'd ask what publish command line you're using. Ensure you are publishing the configuration (Release) that you are building).