dotnet new console and dotnet new
Creates a new console app / lists help for dotnet new
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)
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()
dotnet --info
```bash
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: opensuse-tumbleweed
OS Version: 20191204
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 157910edee
.NET Core SDKs installed:
3.1.100 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Tried Fixes in [Dotnet new fails: Object reference not set to an instance of an object #657](https://github.com/dotnet/templating/issues/657)
ie.
```bash
dotnet new --debug:reinit
rm -rf ~/.templateengine
Did not have this problem with dotnet sdk 2.0.
Update: I installed dotnet core 3.1 via snap - works fine. Could be something missing in the official opensuse package or due to tumbleweed having a different libicu package (libicu-suse65_1).
I'm having exact same problem on Fedora 31.
Running dotnet new throws the following:
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(IEnumerable1 installationRequests, IList1 nuGetSources, Boolean debugAllowDevInstall)
at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable1 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.<
This is the output of my dotnet --info:
`.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: fedora
OS Version: 31
OS Platform: Linux
RID: fedora.31-x64
Base Path: /usr/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 157910edee
.NET Core SDKs installed:
3.1.100 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
`
Any help would be appreciated.
Thanks.
I fixed it by wiping the "/usr/share/dotnet/templates" and "~/.templateengine" folders. Then reinstalling dotnet core 3.1 and then running dotnet new --debug:reinit.
Everything works fine now.
I fixed it by wiping the "/usr/share/dotnet/templates" and "~/.templateengine" folders. Then reinstalling dotnet core 3.1 and then running dotnet new --debug:reinit.
Everything works fine now.
Thanks!
I fixed it by wiping the "/usr/share/dotnet/templates" and "~/.templateengine" folders. Then reinstalling dotnet core 3.1 and then running dotnet new --debug:reinit.
Everything works fine now.
sweet!
I have recieved same error today while installing dotnet 3.1 on centos7. First try was, i've removed all versions by calling yum remove dotnet* and install dotnet 3.1 but no success. (same error.)
Second, uninstalled dotnet 3.1 and deleted remaining files with folder, /usr/share/dotnet. In this time, server were clean and installed dotnet 3.1 again.
Voila, everything working as usual.
Ten铆a el mismo problema con net5.0. Borr茅 "/usr/share/dotnet/templates" como dice JorgeGomez y listo.
Pero ahora me sale el siguiente error: The framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found.
Most helpful comment
I fixed it by wiping the "/usr/share/dotnet/templates" and "~/.templateengine" folders. Then reinstalling dotnet core 3.1 and then running dotnet new --debug:reinit.
Everything works fine now.