“Reference could not be resolved” error when validating your architecture using Visual Studio architecture modeling tools

Importer

When you validate your application architecture in Visual Studio using the modeling tools available from the Architecture menu in Enterprise versions of Visual Studio 2012 and 2013, you may see an error message that the primary reference could not be resolved, and the validation will not proceed. This issue does not affect Visual Studio 2015.

Problem details

In Visual Studio 2012, the message will be similar to this:

The primary reference “{your reference}” could not be resolved because it was built against the “.NETFramework,Version=v4.5.2” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5”.

In Visual Studio 2013, the message will be similar to this:

The primary reference “{Your reference}” could not be resolved because it was built against the “.NETFramework,Version=v4.5.2” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5.1”.

The .NET Framework version numbers may vary, and may include version numbers such as v4.5.2, 4.5.3, 4.6, or higher. The error occurs when the build version is a higher version number than the version that was pre-installed with the version of Visual Studio.

Workaround

The simplest workaround is to edit the modeling project file to ignore target framework version mismatches as follows:

  1. Unload the modeling project by right clicking on it in Solution Explorer window and choosing Unload Project.
  2. Open the project file into the editor by right clicking on it in Solution Explorer window and choosing Edit projectname.modelproj.
  3. Add the following element inside the <Project> element:

    <PropertyGroup>

    <ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch>true</ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch>

    </PropertyGroup>

  4. Save the project file.
  5. Right click on the modeling project in Solution Explorer and choose Reload Project.
  6. Validate your architecture in the usual way.

 

For more information about validating your application architecture, see Validating Your System During Development on MSDN.

0 comments

Discussion is closed.

Feedback usabilla icon