我看过其他类似的问题而没有运气。
以下是解决方案设置:
External Solution
- Project A
- Project B (dependency on project A, and on EntityFramework)
Primary Solution
- Project A (included through "Add Existing Project" dialog)
- Project B (same as above)
- Web project
当我尝试检查此主要解决方案时,构建服务器无法执行以下操作:
CodeFileInProjectB.cs (4): The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
CodeFileInProjectB.cs (11): The type or namespace name 'DbPropertyEntry' could not be found (are you missing a using directive or an assembly reference?)
显然未能解决项目B对EF的依赖性。我已经检查了所有引用,我甚至做了那个你确保{cproj文件中有<Private>True</Private>
的东西。
我是否错误地引用了外部项目?到底他妈发生了什么?我已经尝试了8次,提出了各种SO问题的不同建议,但没有运气。
答案 0 :(得分:0)
有两种方法:或者您在使用代码时签入包,或者在构建时使用get the packages on-the-fly。 优点和缺点以及详细步骤都在ALM Rangers指导的next version中。
答案 1 :(得分:0)
除了@Giulio Vian关于NuGet包恢复的评论之外,请确保项目B通过使用任何文本编辑器打开其项目文件(即b.csproj
)来正确引用EF并验证HintPath
元素是正确的。额外的或遗漏的..\
将导致构建失败。
有效的参考示例:
<Reference Include="EntityFramework">
<HintPath>..\packages\EntityFramework.6.0.2\lib\net45\EntityFramework.dll</HintPath>
</Reference>