Answered by:
The primary reference "" could not be resolved because it has an indirect dependency on the assembly EntityFramework with higher version

Question
-
I have Core.Framework C# project which was built using .Net Framework 4. The framework was referencing EF 5 assembly. There are other C# projects which are referencing Core.Framework. These other project's target framework is also .net 4. Recently we upgraded EF5 to EF6. The Target framework of Core.Framework & all other projects is still .Net 4. We have MSBuild's .proj file that builds all the solutions. We use TFS's build definition to invoke this build...so far so good. build is working fine.
When i build the solution in VS 2013 IDE i do not get any error or warning,
When TFS builds the solution using .proj file i do not get any error or warning,
When on local machine i build solution using MSBuild command line then also i do not get any error or warning
msbuild MyMainSolution.sln
However on local machine whenever i use MSBuild command line to build .proj file i get the following error
The primary reference "Core.Framework" could not be resolved because it has an indirect dependency on the assembly "EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken
=b77a5c561934e089" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".I am using the following command to build the .proj file
msbuild Main.proj /t:Clean;MyTarget;Package -p:Configuration=Release;OutputPath=C:\Build
- Moved by Starian chenMicrosoft contingent staff Monday, November 9, 2015 2:52 AM
Friday, November 6, 2015 9:00 PM
Answers
-
tool version 11 is not valid so it didn't work. But 12.0 is valid for VS 2013
however my original command did work when i removed OutputPath argument
msbuild Main.proj /t:Clean;MyTarget;Package -p:Configuration=Release;
- Proposed as answer by Jamles Hez Tuesday, November 17, 2015 7:34 AM
- Marked as answer by Jamles Hez Wednesday, November 18, 2015 7:28 AM
Monday, November 16, 2015 9:30 PM
All replies
-
Hi lax4u,
According to your description, this issue is related to MSBuild, the MSBuild forum is a better place for this issue and I will move it there for you.
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Monday, November 9, 2015 2:50 AM -
Hi lax4u,
>>However on local machine whenever i use MSBuild command line to build .proj file i get the following error
May I know if the local machine you mentioned is the one only installed Visual Studio Build Tool, or the machine installed fully VS, but you simply use the MSBuild tool to build the application?
Basically I think the problem happens on when using MSBuild, the default toolset it .net framework 4.0, and your EF project is upgrade to .net framework 4.5 which cause the error.
I would recommend you try following code
msbuild Main.proj /tv:11.0 /t:Clean;MyTarget;Package -p:Configuration=Release;OutputPath=C:\Build
to see if this works.
--James
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Tuesday, November 10, 2015 3:34 AM -
tool version 11 is not valid so it didn't work. But 12.0 is valid for VS 2013
however my original command did work when i removed OutputPath argument
msbuild Main.proj /t:Clean;MyTarget;Package -p:Configuration=Release;
- Proposed as answer by Jamles Hez Tuesday, November 17, 2015 7:34 AM
- Marked as answer by Jamles Hez Wednesday, November 18, 2015 7:28 AM
Monday, November 16, 2015 9:30 PM -
Sorry for my mistake, it should be 12.0 instead of 11.0, mistype.
>>however my original command did work when i removed OutputPath argument
OK....Well, so it works fine now. But I'm not that sure if remove OutputPath will get MSBuild work since your error is not about file/folder access related. Anyway, good to know you solve the problem.
--James
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Edited by Jamles Hez Tuesday, November 17, 2015 7:34 AM
Tuesday, November 17, 2015 7:34 AM