Unable to build Unit Test project due to build error in referencing dependent project


Unable to build Unit Test project due to build error in referencing dependent project in visual studio 2013 project. Error: The type or namespace name 'xxx' could not be found(are you missing a using directive or an assembly reference?) Warning: the primary reference "xxxx\bin\Debug\xyz.dll" could not be resolved because it was built against the .NETFramework, Version=v4.5.1" framework. This is a higher version than the currently targeted framework ".NETFramework, Version=v4.5"

I was trying to build Unit Test project but it did not build successfully due to build error in referencing dependent project.

Found below error message in the error list window and the below warning message in the Warning window

Error: The type or namespace name 'xxx' could not be found(are you missing a using directive or an assembly reference?)

Warning: the primary reference "xxxx\bin\Debug\xyz.dll" could not be resolved because it was built against the .NETFramework, Version=v4.5.1" framework. This is a higher version than the currently targeted framework ".NETFramework, Version=v4.5"

The referenced project 'xyz' is targeting a higher framework version(4.5.1) than this project's current target framework version(4.5). This may lead to build failures if types from assemblies outside this project's target framework are used by any project in the dependency chain.

Follow the below steps to resolve the issue:

Step 1: Right click the unit test project -> Go to Properties -> Make sure Application is highlighted on the left hand side -> Target Framework is .NET Framework is 4.5
Target Framework
Step 2: Update the .NET Framework version to 4.5.1 as shown below:
.NET Framework 4.5.1
Step 3: Click on Yes on the Target Framework Change dialog box as shown below.
.NET Framework 4.5
Step 4: Now build the solution. This should resolve the errors and build the project successfully.


Comments

Author: Gaurav Kumar Arora08 Jun 2015 Member Level: Gold   Points : 0

Hi Priya,

I read your troubleshooting article and its worthful for me. Many techies face such issues. Thanks for sharing such valuable contents. Keep posting good things here

Author: Vaishali Jain09 Jun 2015 Member Level: Gold   Points : 0

Thanks Gaurav.. Its just real time experience I face while developing application which I would like to share so others can be more productive getting help to their problems.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: