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
Step 2: Update the .NET Framework version to 4.5.1 as shown below:
Step 3: Click on Yes on the Target Framework Change dialog box as shown below.
Step 4: Now build the solution. This should resolve the errors and build the project successfully.
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