VS 2015: The primary reference “Sitecore.Kernel” could not be resolved because it was built against the “.NETFramework,Version=v4.7.1” framework.


For those users, who are still working on VS 2015, while building your Sitecore MVC Project, you tend to get the following Errors:

1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3274: The primary reference “Sitecore.Kernel” could not be resolved because it was built against the “.NETFramework,Version=v4.7.1” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5.2”.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3275: The primary reference “Sitecore.Mvc” could not be resolved because it has an indirect dependency on the assembly “Sitecore.Kernel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=null” which was built against the “.NETFramework,Version=v4.7.1” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5.2”.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3274: The primary reference “Sitecore.Mvc” could not be resolved because it was built against the “.NETFramework,Version=v4.7.1” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5.2”.

Possible reason:

Target Framework version of the Sitecore VS Project is an older version that is not supported by Sitecore.Kernel which expects at least .Net Framework 4.7.1.

Fix:

You will have to upgrade your VS Project Target Framework to .Net Framework 4.7.1 or above. Installing the latest .Net Framework Runtime will not resolve the issue. Your machine might still be running the latest .Net Framework Runtime.

To check your current .Net Framework version, you do the quick check below:

Navigate to C:\Windows\Microsoft.NET\Framework\v4.0.30319
Type “cmd” on your Windows Explorer Search bar
Run the following command: .\MSBuild.exe -version

To fix the VS Project Build Version you will have to install the .Net Developer Pack 4.7.1 for Visual Studio 2015.

Here is the Download link:

https://www.microsoft.com/en-us/download/details.aspx?id=56119

Once your Download and install the Developer Pack, you will be able to switch the Sitecore VS Project Target Framework to 4.7.1 under Project Properties and follow through the VS framework switch warning prompts.

Continue Building the Project and your errors will disappear.

Hope this helps!

Feel free to leave a reply here...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: