ASP.NET Core 脚手架在 VS 2017 中不起作用 [英] ASP.NET Core Scaffolding does not work in VS 2017
问题描述
我在 Visual Studio 2017 中有一个初学者的 ASP.NET Core 项目,我正处于 HelloWorld 的脚手架步骤.脚手架不起作用,我在第一台计算机上测试,然后在第二台...
I have a beginner ASP.NET Core project in Visual Studio 2017, and I am at the scaffolding step of the HelloWorld. The Scaffolding does not work, I tested on a first computer, then at a second one...
当我尝试生成带有视图的控制器时,它在第一台机器上给出以下错误:
when I try to generate a controller with views , it gives the following error on the first machine:
微软 Visual Studio
Microsoft Visual Studio
错误
运行所选代码生成器时出错:
There was an error running the selected code generator:
'未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集'Microsoft.VisualStudio.Web.CodeGeneration.Utils,版本=1.1.1.0,Culture=neutral,PublicKeyToken=adb9793829ddae60'.该系统找不到指定的文件.在 Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)'
'Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)'
好的
在第二台机器上:
微软 Visual Studio
Microsoft Visual Studio
错误
运行所选代码生成器时出错:
There was an error running the selected code generator:
'错误:未找到依赖项清单中指定的程序集 -- 包:'microsoft.applicationinsights.aspnetcore',版本:'2.1.0',路径:'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll''
'Error: assembly specified in the dependencies manifest was not found -- package: 'microsoft.applicationinsights.aspnetcore', version: '2.1.0', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll''
好的
推荐答案
以下对我有用.
我删除了 bin
&obj
文件夹,再次构建项目,它就可以工作了.
I deleted bin
& obj
folders, build the project again and it works.
如果它给你错误:它在 debug
文件夹中找不到 project.deps.json
.
In case if it gives you error: it couldn't find project.deps.json
in debug
folder.
将项目设置为调试,运行它,现在您可以添加脚手架项目.
Set project to debug, ran it and now you can add scaffolded items.
这篇关于ASP.NET Core 脚手架在 VS 2017 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!