AspNetZero-.NET Core 2.0 MVC版本-添加新控制器时出错 [英] AspNetZero - .NET Core 2.0 MVC Version - Error on adding new controller
问题描述
大约6个月后,我恢复了基于.NET Core 2.0的AspNetZero解决方案的工作. 我有原始下载版本和修改版本作为单独的GIT存储库.在两个版本/存储库中,当我尝试添加新的MVC控制器时,都会不断收到以下错误消息.
After about 6 months, I returned to work on my AspNetZero solution based on .NET Core 2.0. I have the original downloaded version and the modified version as separate GIT repositories. In both versions/repositories when I try to add a new MVC controller, I keep getting the below error message.
在我的PC上,我安装了从1.0一直到2.1.302的所有.NET Core SDK.我正在处理其他项目,正在使用.NET Core 2.1.
On my PC I have all of the .NET Core SDKs installed from 1.0 right up to 2.1.302. I have other projects that I am working on, where I'm using .NET Core 2.1.
我什至在VS2017中创建了一个全新的.NET Core 2.0项目,并且能够搭建一个新的MVC控制器而没有任何错误.此问题仅在AspNetZero解决方案上发生.
I even created a brand new .NET Core 2.0 project in VS2017 and I am able to scaffold a new MVC controller without any errors. This issue is only happening on the AspNetZero solution.
我已经进行了很多搜索以寻找解决方案,但是我在网上找到的答案都没有起作用.我只是将一个global.json文件添加到了我的解决方案文件夹中,并将SDK设置为2.0.0,然后再次尝试,仍然无法正常工作.我不断收到相同的错误!
I have done many searches for a solution and none of the answers I found online have worked. I just added a global.json file into my solution folder and set the SDK to 2.0.0 and tried again, still does not work. I keep getting the same error!
推荐答案
- 根据您的情况,您的NuGet软件包可能无效 目标框架.检查所有您最近的.NET Core NuGet程序包 版本.
- 清除您的NuGet缓存,如图所示
- Your NuGet packages may have been invalid according to your target framework. Check all your recent NuGet packages for .NET Core versions.
- Clear your NuGet cache as shown in the picture
这篇关于AspNetZero-.NET Core 2.0 MVC版本-添加新控制器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!