Wednesday, May 11, 2016

Upgrading Sitefinity Web Application Projects

While upgrading Sitefinity versions in general has gotten easier over time, one of the MAJOR problems developers still face today even with the latest releases of Sitefinity is upgrading Sitefinity Web Application projects (especially when they are under source control).

The reason this remains a problem is because all of the Sitefinity Web Application project references are referring to the bin directory of the project.

Therefore, when you use the Sitefinity Project Manager, it appropriately updates the assemblies in the bin folder for you.

However, all of the Project References in the Sitefinity Web Application C# project file still refer to older assembly versions!

The problem originates from the fact that the specific version numbers are directly hardcoded into the .csproj file.

So, when you compile the application with these outdated assembly version numbers, the Sitefinity Web Application continues to think that it needs a particular assembly version to execute at runtime, causing innumerable problems for developers to resolve.

For example, you may have a reference like the following in your .csproj file:


<Reference Include="Telerik.Sitefinity.Frontend, Version=1.3.350.0, Culture=neutral, PublicKeyToken=b28c218413bdf563, processorArchitecture=MSIL">
      <HintPath>packages\Telerik.Sitefinity.Feather.Core.1.3.350.0\lib\net45\Telerik.Sitefinity.Frontend.dll</HintPath>
      <Private>True</Private>
    </Reference>

Instead, you probably want to have something like the following in your .csproj file:


<Reference Include="Telerik.Sitefinity.Frontend">
      <HintPath>bin\Telerik.Sitefinity.Frontend.dll</HintPath>
      <Private>True</Private>
    </Reference>

This change eliminates the direct assembly version dependency in the .csproj file as you noticed earlier and makes upgrades much more flexible.

If you are using a framework such as Sitefinity Feather which has available NuGet packages, then you will also want to make sure that you verify which version of Sitefinity Feather is compatible with your particular version of Sitefinity:


The update shown above for Sitefinity Feather works with Sitefinity v. .9.0, but if you are using an OLDER version of Sitefinity (such as Sitefinity v. 8.2), then you will need to ensure that you are choosing an appropriate version of the Sitefinity Feather assemblies that is compatible with your particular version (which is relatively easy to accomplish in Visual Studio 2015):


Once you have worked through all those hurdles in your Sitefinity Web Application project, hopefully you should be able to build your project/solution and compile a properly upgraded Sitefinity Web Application project!

NOTE: DO NOT REBUILD, just BUILD, since a REBUILD may wipe out all of the assemblies in the Sitefinity bin directory!!

Good luck with your Sitefinity upgrades!!

No comments:

Post a Comment