【发布时间】:2017-05-02 07:05:26
【问题描述】:
我正在关注Contoso University,遇到了in this SO question 提到的关于脚手架创建错误的 HP 计算机平台问题,说 deps.json 在某个文件夹中不存在。
我正在运行 Windows 7 Professional 并使用 Visual Studio 2017 Community。
我已通过在命令提示符中使用 set Platform= 将环境变量 Platform 从 BPC 更改为无。
当我尝试 Right Click on the Controllers folder > Add > New Scaffolding Item... > MVC Controller with views, Using Entity Framework > Fill out the form by picking a Model class and Data context class > Add > 时仍然收到错误
Error
There was an error running the selected code generator:
'The specified deps.json [C:\...\bin\BPC\Debug\netcoreapp1.1\ContosoUniversity.deps.json] does not exists'
我已尝试清理解决方案、重新启动 Visual Studio 2017 并重新启动计算机,但均无济于事。 不知道我应该做些什么来防止这个错误。有什么建议么?我觉得将文件复制到 BPC 文件夹是一种解决方法,但不是最佳解决方案。
编辑 1
我注意到环境变量 Platform 被重置为 BPC,所以我将其删除并重新启动。没有回来。
现在,当我尝试创建脚手架时,出现此错误:
Error
There was an error running the selected code generator:
'Value cannot be null.
Parameter name: connectionString
at
Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b_6_0()
at
Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at
Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)'
编辑 2
手动将 Platform 变量设置回 BCP 会恢复原来的错误。
将所有文件从...\ContosoUniversity\bin\Debug\netcoreapp1.1\ 复制并粘贴到...\ContosoUniversity\bin\BCP\Debug\netcoreapp1.1\ 让我克服了那个错误,但是来自Edit 1 的错误又回来了。
似乎我有两个不同的问题。
【问题讨论】:
标签: visual-studio entity-framework asp.net-core-mvc