首页 > 其他 > 详细

Getting ready... Object reference not set to an instance of an object.

时间:2021-02-17 13:40:44      阅读:27      评论:0      收藏:0      [点我收藏+]

之前在centos上使用`dotnet new`, dotnet new webapi -o testapi

[slin@izu templates]$ dotnet new webapi -o wannianapi
Getting ready...
Object reference not set to an instance of an object.
   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save(TemplateCache cacheToSave)
   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save()
   at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests, IList`1 nuGetSources, Boolean debugAllowDevInstall, Boolean interactive)
   at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests, IList`1 nuGetSources, Boolean debugAllowDevInstall, Boolean interactive)
   at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests)
   at Microsoft.DotNet.Tools.New.NewCommandShim.FirstRun(IEngineEnvironmentSettings environmentSettings, IInstaller installer)
   at Microsoft.TemplateEngine.Cli.New3Command.ConfigureEnvironment()
   at Microsoft.TemplateEngine.Cli.New3Command.Initialize()
   at Microsoft.TemplateEngine.Cli.New3Command.ExecuteAsync()
   at Microsoft.TemplateEngine.Cli.CommandParsing.NewCommandInputCli.<>c__DisplayClass19_0.<<OnExecute>b__0>d.MoveNext()

Solution:

rm -rf /usr/share/dotnet/templates/


# 根据你已经安装的SDK, 重新安装templates
# https://www.nuget.org/packages?packagetype=template&sortby=relevance&q=Microsoft.DotNet&prerel=True

dotnet new --install Microsoft.DotNet.Web.ProjectTemplates.5.0::5.0.3

dotnet new --install Microsoft.DotNet.Common.ProjectTemplates.5.0::5.0.3

我这边暂时安装了两个:
- Microsoft.DotNet.Web.ProjectTemplates.5.0
- Microsoft.DotNet.Common.ProjectTemplates.5.0
之后再运行:`dotnet new` 看看就正常了

Getting ready... Object reference not set to an instance of an object.

原文:https://www.cnblogs.com/swlin/p/14408513.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!