By default, Sitefinity assembly references are in the /bin folder which makes future updating process harder. Additionally, all binaries should be stored in the source control which is not ideal. Switching to NuGet packages resolves those problems. Let’s start.
First, we must backup our project and its database.
Second, we must check our exact Sitefinity version either from the bottom left corner of the admin dashboard or from the Sitefinity CMS Project Manager app. In my case, it was 10.0.6412.0.
After backup and version check, we will need to remove all references from the .csproj file. To do that right click on the project in the ‘Solution Explorer’ and choose ‘Unload Project’ then again right click and Edit.
From the .csproj file remove all Sitefinity references that are pointing to bin\ folder. As an existing project, there might be assemblies that we have been added. Additionally, we should not remove them. The references in the .csproj file look like:
Save the file and reload the project.
Next step is to delete and the referred files in the bin\ directory.
Installing NuGet packages
Right-click on the project from the ‘Solution Explorer’ and choose ‘Manage NuGet Packages.’ From the ‘Package source’ dropdown select ‘Sitefinity NuGet Server’ (or the name you set). After that choose browse tab and search for Telerik.Sitefinity.All. This is the package with all Sitefinity CMS related assemblies. When the package is selected, you can choose the needed version using the dropdown on the right side.
This is important, the version we need to choose is the version of our Sitefinity and in my case, 10.0.6412 which is not the latest. When selected the right version press the Install button.
There might be file conflicts when the installation begins like with ResourcePackages/LICENSE.md. In my case, I overwrote them all.
After complete loading of all assembly references unload the project as we did earlier and check in the .csproj the references are with packages/ paths:
If we followed all steps correctly, everything should be alright, and we can reload the project.
Te final step is to Build the project (ctrl+shift+B), and everything should run smoothly.In case you stumble upon some error and need more detailed information, you can check Milan’s post Resolving Sitefinity Assembly Binding Errors After Upgrade.