Edit

Share via


MSB3274: The primary reference 'name' could not be resolved because it was built against the 'version' framework

The full error is similar to the following text:

 The primary reference 'name' could not be resolved because it was built against the 'version' framework. This is a higher version than the currently targeted framework 'version'.

This error occurs in .NET Framework projects when the version of a reference is higher than the version you are currently building for. Consider targeting a more recent version of the .NET Framework. For instance, if your project targets .NET Framework 4.7.2, you might see this error if you reference a NuGet package or another project that targets .NET Framework 4.8.

In Visual Studio, check the Target framework in the project's property pages. See Framework targeting overview.

In a project file, you can set the target framework as follows:

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

To suppress this error you can set the following MSBuild property:

<PropertyGroup>
  <ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch>true</ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch>
</PropertyGroup>

For a guide on resolving errors with assembly references, see Troubleshoot assembly references.

See also