HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Upgrade to .NET Framework 4.5

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

EPiServer 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 we recommend all projects to target this version or newer whenever possible.

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

Upgrading steps

Development environment

  1. Support for .NET 4.5.2 in Visual Studio 2013/2013 is 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
    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

If .NET Framework 4.5 is not installed on the production server, it is no longer available.

Troubleshooting

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>