HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Upgrade to .NET Framework 4.5

This topic describes how to upgrade to .NET Framework 4.5.

Optimizely Content Management System (CMS) products that supports .NET Framework 4 also supports the .NET Framework 4.5 update. Since .NET 4.5 in an in-place update many installations already run on this version even though not specifically targeting any of the new features.

EPiServer NuGet packages EPiServer.CMS.Core 7.14 and higher requires .NET Framework 4.5 to be used as the target framework in Visual Studio. Currently the only version of .NET Framework 4.x that Microsoft will support beyond 2015 is .NET Framework 4.5.2 so Optimizely recommends all projects to target this version or newer whenever possible.

Currently the NuGet packages provided by CMS support all versions in the .NET 4.5.x series since many projects run on previous versions but that may change going forward.

Upgrade steps

Development environment

  1. Support for .NET 4.5.2 in Visual Studio 2013/2013. (No longer available)
  2. Go the projects properties and make sure the target framework is 4.5.2:

  1. Some NuGet packages have an assembly optimized for .NET 4.5, you will see an error message describing which packages to re-install to get the new assembly.
    Run the following command from the "Package Manager Console" for each package in the error message that shows up while changing target version. 
    Update-Package –reinstall <packageName>
    In a default CMS site created via the Visual Studio extension the following packages have to be re-installed: Castle.Core, Castle.Windsor, EntityFramework, Newtonsoft.Json.

Production environment

.NET Framework 4.5 is no longer available.

Troubleshoot

Compiler error: 'EmailAddressAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.EmailAddressAttribute' and 'EPiServerSite4.Business.EmailAddressAttribute.

A class with the same name and functionality exists in version 4.5 of .NET Framework, this class can be deleted from the project.

Error 1 The command "C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe "C:\EPiServer\SP\wwwroot\[MSBuild]\Scripts.xml"
C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe "C:\EPiServer\SP\wwwroot\[MSBuild]\Stylesheets.xml"" exited with code 9009.

There are missing quotation marks in the post build event, you can fix this by editing the project file (MyProject.csproj):

<PostBuildEvent>

**"**$(MSBuildBinPath)\\msbuild.exe**"** "$(ProjectDir)\[MSBuild\]\\Scripts.xml"  
"$(MSBuildBinPath)\\msbuild.exe" "$(ProjectDir)\[MSBuild\]\\Stylesheets.xml"

</PostBuildEvent>

There are missing quotation marks in the post build event, you can fix this by editing the project file (MyProject.csproj):

<PostBuildEvent>

**"**$(MSBuildBinPath)\\msbuild.exe**"** "$(ProjectDir)\[MSBuild\]\\Scripts.xml"  
"$(MSBuildBinPath)\\msbuild.exe" "$(ProjectDir)\[MSBuild\]\\Stylesheets.xml"

</PostBuildEvent>