【发布时间】:2019-10-24 19:24:15
【问题描述】:
尝试在 EF 中创建初始迁移时遇到一个奇怪的错误。
我有几个项目 - 主要是 .NetStandard。 每个项目都会导入自定义 .targets 文件。只是 .csproj 文件顶部的这些行:
<Import Project="$(SolutionDir)Common.targets" />
现在,当我构建我的应用程序时,一切正常。当我运行桌面项目(使用那些 .NetStandard dll)时,一切正常。
但是当我尝试添加初始数据库迁移时,我收到如下错误:
D:\SolutionDir\ProjectDir\Project.csproj: error MSB4019: Cannot find imported project file: "D:\SolutionDir\ProjectDir\Common.targets" Make sure that the path in <Import> declaration is valid and the file exists.
请注意,我使用的是 $(SolutionDir),因此有效路径为:“D:\SolutionDir\Common.targets”。那他为什么要在项目目录中搜索这个文件呢?
【问题讨论】:
标签: visual-studio .net-core entity-framework-core entity-framework-migrations