每当运行dotnet ef迁移时接收MSB1006

时间:2018-06-01 12:26:57

标签: c# entity-framework

问题: 每当我尝试在我的解决方案中执行迁移时,我都会收到一个神秘的错误。

MSBUILD:错误MSB1006:属性无效。

执行的示例命令:

dotnet ef migrations add

dotnet ef migrations script

返回示例错误

MSBUILD : error MSB1006: Property is not valid.
Switch: \tmpBCE7.tmp

For switch syntax, type "MSBuild /help"
Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core 
project. If you're using custom BaseIntermediateOutputPath or 
MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath 
option.

我一时兴起检查了我的环境变量并注意到用户变量中的我的TMP变量添加了一个分号(如图所示)。 通过删除并重新添加TMP环境变量而不添加分号,我能够在项目中运行迁移时避免错误。 enter image description here

1 个答案:

答案 0 :(得分:1)

同样,在我的情况下,通过确保TMP变量没有附加任何特殊字符来解决问题。删除分号允许我的迁移命令无错误地运行。

相关问题