Speed up updating your NuGet DLLs versions during the Sitecore upgrade.

Jack Spektor
3 min readJul 26, 2023

--

If you ever were doing Sitecore upgrade you must know that one of the steps of such upgrade is always changing the referenced NuGet version of Sitecore DLL dependencies in your solution.

And then you build the solution and try to test it in your local Docker environment… to realize that some of the artifacts still have old DLL versions.

Here are some lifehacks that you can use to speed up the upgrade/debugging process for this:

I. Check your references against the Sitecore assembly list

If you are starting the upgrade you can really save your time on updating the assembly versions by checking the official Sitecore assembly list that is available from Sitecore release page on the Sitecore Developer portal.

II. Cleaning up the solution bin/obj folders

Sometimes some of the project artifacts can be cached in bin/obj folder with older version.

As a result you get it published into the artifacts and then the time gets wasted on finding the origin of the mismatched version DLL.

Instead — delete all the bin/obj folders in whole solution as soon as you done upgrading references.

That could be done with easy PowerShell command:

gci -include bin,obj -recurse | remove-item -force -recurse

Now you’ll have a clean instance with no cached DLLs, so you can be sure that all next builds are running from a clean slate.

III. Comparing the DLL versions of the Docker container with and without artifacts

So you upgraded the solution, built it with no compile-time errors and still when you copy the artifacts to your Docker CM instance you get the Unhealthy container?

The most likely explanation is that you still might be getting some assembly version mismatch.

One of the options is to connect to the container with a command-line and go compare one-by-one each DLL.

There is however an easier way to do this with PowerShell:

Get-ChildItem *.dll | Sort-Object Name | `
Select-Object -Property Name, `
{[Reflection.AssemblyName]::GetAssemblyName($_.FullName).Version} | `
Out-File dllversions.txt

This would create a handy file on your Docker container with a list of DLLs in your bin folder and their versions.

Now you can copy the file to your local with this Docker command:

docker cp [containername]:C:\inetpub\wwwroot\bin\dllversions.txt dllversions.txt

You can even run the same command against the blank Sitecore CM docker container without any custom code artifacts, copy it and then compare it with a diff-tool!

Voila!

Wish you a speedy and easy Sitecore upgrade!

--

--

Jack Spektor
Jack Spektor

Written by Jack Spektor

Sitecore MVP 2018–2020, Sitecore Developer in AKQA, traveler and lover of life.